react-select-search icon indicating copy to clipboard operation
react-select-search copied to clipboard

Wrong handling of ESC key

Open Vovan-VE opened this issue 4 years ago • 1 comments

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 avatar Jan 15 '21 07:01 Vovan-VE

@Vovan-VE Very good, thanks for the report. Will look into it.

tbleckert avatar Apr 08 '21 23:04 tbleckert