jarek-foksa / xel

Xel - Widget toolkit for building native-like Electron and Web apps
https://xel-toolkit.org
Other
682 stars 59 forks source link

key attribute of x-shortcut conflicts with react's key attribute #29

Closed rockiger closed 7 years ago

rockiger commented 7 years ago

It seems to me, that the key attribute for the x-shortcut is "misread" by react as an identification key. This way I can't display shortcuts correctly. I can only display the modifiers, but the character of the shortcut is not shown (see picture).

Is it possible to rename the key attribute to char or val?

x-shortcut-react-conflict

FYI, I am not using react directly, but with Clojurescript and Reagent. IMO the problem should persist with JSX.

jarek-foksa commented 7 years ago

The current declarative API feels a bit awkward, I think I should change it to something like this:

<x-shortcut value="Control+Shift+A"></x-shortcut>

where the value can consist from any key names defined in https://www.w3.org/TR/uievents-key/, separated by "+" sign. I will fix it later this week as I have quite a lot of code relying on the current API.

BTW, is there a list of other attributes that have special meaning in React?

rockiger commented 7 years ago

Cool, thanks.

BTW, is there a list of other attributes that have special meaning in React?

Not that I am aware of. Some work differently, but this shouldn't be a problem: https://facebook.github.io/react/docs/dom-elements.html.

With the key attribute the problem is, that react omits it

jarek-foksa commented 7 years ago

I have changed the API to <x-shortcut value="Control+Shift+A"> syntax in Xel version 0.0.44.

rockiger commented 7 years ago

Something doesn't seem to work on non apple machines: the modifiers are not shown. The first image is from Linux (same thing for Windows 10) and the second is from a Mac. spectacle f20770 spectacle t20770

jarek-foksa commented 7 years ago

@rockiger This should be now fixed in version 0.0.48.

rockiger commented 7 years ago

Works like a charm now!

Thanks a lot!

a-y-u-s-h commented 3 years ago

How do you use it in React? What do I need to import from xel to make it work?

jarek-foksa commented 3 years ago

@a-y-u-s-h Please check the instructions on https://xel-toolkit.org/setup