react-select-search
react-select-search copied to clipboard
Wrong handling of ESC key
Hello.
Version: 2.2.4.
I have a dialog (rc-dialog
in my case), closable by ESC key out of the box, with SelectSearch
inside it. When dropdown list is opened, pressing ESC key cause SelectSearch
to close the dropdown.
The problem is that stopPropagation()
was not called on event and the same event bubbling cause dialog to close too. Also another potential problem is the SelectSearch
uses keyup
event to handle ESC key instead of keydown
.
Proposed solution is to move ESC key handling to keydown
event and call stopPropagation()
when ESC handled to actually close dropdown. From the end user view 1st ESC press should to close the dropdown and the second ESC press should to close a dialog.
@Vovan-VE Very good, thanks for the report. Will look into it.