![]() However, if you have a different view on this, please create an issue/request on GitHub. ![]() I found it hard to come up with a meaningful use case for passing an keyboard event object or the relevant key to a component. I believe this is not a good use case of HoC. The one left on the top of the stack is the one only exclusive handler. Technically, exclusive handlers are put into a stack upon mounted or when changed from non-exclusive to exclusive Įxclusive handlers are removed from the stack upon unmounted or disabled or changed to non-exclusive. If more than one enabled handlers are isExclusive, the most recently mounted/assigned handler wins. If the user presses ALT+F2, a different Help pop-up is displayed with additional information. When the modal is closed/unmounted, they will be working again. Gets a value indicating whether the ALT key was pressed. When the modal opens,Īll other handlers will be temporarily suspended. In the above example, the key handler in the modal could set to be isExclusive. When a handler set to isExclusive,Īll other key handlers will be suspended. The isExclusive prop can be really helpful in this situation. There could be other key handlers in your app, they all should be disabled to avoid unexpected results. In sequence 1 & 3, the KeyboardEvent.key attribute is defined and is set appropriately to a value according to the rules defined earlier. A keyup event is fired once the key is released. The product options in the modal and the product list in the background at the same time. The events will be fired repeatedly while the key is held down. console.log(`do something upon keydown event of $). Supports handling multiple keys (as an array) by one handler ĭemo/dist/index.html Installation npm install react-keyboard-event-handlerĪPI Basic usage import KeyboardEventHandler from 'react-keyboard-event-handler'.Provides easy-to-use key names and key alisa such as numeric and alphanumeric to free you from dealing with numeric key codes.On keydown event alt is pressed - so it returns keycode 18 and true, on keyup alt is not pressed, so the result is 18 and false. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |