react-hotkeys
react-hotkeys copied to clipboard
[request] please reconsider setting allowChanges to default false
Is your feature request related to a problem? Please describe.
i understand from this comment that allowChanges
was introduced in v2 to be "optimized by default". however this breaks the react paradigm of what normally happens when you pass in props. This is extremely unidiomatic and anyone on the react team will back me up.
It cost me half a day of questioning my sanity and react knowledge. please do not optimize unidiomatically for me. especially for something that really doesnt change that frequently at all.
Describe the solution you'd like default it to true.
Describe alternatives you've considered nil. this library is great otherwise.
Both ignoreTags and ignoreKeymapAndHandlerChangesByDefault costs me half a day to find why HotKeys which contains autoFocus textarea does not fire.
In my case after focus -> blur -> focus
on textarea it calls right handler.
(My callback checks whether textarea input is not empty then calls submit.)
I understand that performance is important, but IMO it should be done by React's idioms like useCallback()
+ useEffect()
.
Hi @sw-yx and sw-yx, thanks for sharing your experience of using the library.
I don't necessarily disagree with you. The case for optimising in this fashion is somewhat diminishing as parts of the library have been rewritten to be more performant.
I'll consider it for a later release.
I'll leave this open for now for anyone else to share their thoughts.