downshift-js / downshift

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
http://downshift-js.com/
MIT License
12.08k stars 928 forks source link

Escape with multiselect open selects an item #1342

Closed togakangaroo closed 1 year ago

togakangaroo commented 2 years ago

Just quickly clicking through the demo page

Relevant code or config

Exactly what's on the demo page for multiselect, using Chrome latest (96)

What you did: I opened the multiselect dropdown (using my keyboard but I don't think it matters) and then hit escape to close it without selecting any options

What happened: The top option was added to the selection list even though I was expecting it to close with no state change

silviuaavram commented 2 years ago

https://www.downshift-js.com/use-multiple-selection are you referring to this? I can close the list with Esc and no item is added to the selection. Also using Chrome.

nmanandhar commented 2 years ago

I noticed that when pressing F12 or any of the Function keys, an item gets selected. This also occurs for useCombobox

silviuaavram commented 2 years ago

I don't understand. Please submit a list of steps with a repro environment. Otherwise I'm closing this.

Go1dExperience commented 2 years ago

I can't reproduce this issue with the Escape key, but @nmanandhar is right about the function key. If you open the combo box, hover on any item, then press a function key, for some reason that item will be selected. You can try with any combo box from the code sandbox @silviuaavram