jarek-foksa/xel

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

rockiger opened this issue · 8 comments

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.

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?

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

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

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

@rockiger This should be now fixed in version 0.0.48.

Works like a charm now!

Thanks a lot!

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

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