Keyboard interactions catches the focus for the entire application
neacsugeorge opened this issue · 3 comments
Hi there,
Since you've added the keyboard interactions, it catches the focus on any key down event even if the menu isn't focused.
We had to revert to using version 2.5.2 because it breaks our application. It didn't matter if the user was on a textarea or a simple input, pressing up/down would focus the menu.
The only way to disable this was to provide a custom onKeyDown function but that would lead to unexpected behaviours.
Hi @neacsugeorge,
Do you mean it catches the keyboard interactions while the menu is open?
That would make sense, as the menu basically assumes that if it is open, the user is interacting with it and not other page contents.
If you do want the rest of the page to be usable while the menu is open, a custom keydown handler is the way to go. Not sure what unexpected behaviours you're seeing with that, but you can still tab through all the elements even if you just pass a no-op like: customOnKeyDown={() => {}}
Hi @negomi,
Thank you for your answer.
Our application has a push menu open 90%+ of the time and having it catch the focus is problematic for us. We target desktop users.
Passing that no-op could lead to unexpected behaviours.
Hey @neacsugeorge,
The no-op should not cause unexpected behaviours with the rest of your app. It doesn't overwrite the global window.onkeydown
, just adds an extra listener. The only thing that would be lost is the menu's 'close on escape' functionality, so you would have to implement that yourself if you still want it.
I'm going to close this out for now because I don't think this is a bug with the menu, but feel free to let me know if you have more questions.