You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement a multiselect combobox with react. I can make it work perfectly with the mouse interaction, but with the use of the keyboard arrow + enter key, I don't manage to prevent the user from selecting an option multiple times (by pressing enter many times). Field value contains the selected option multiple times in its array.
The best work around I found for now is the deactivate the enter key, but I feel like it remove some useful functionnality : <Combobox.Input onKeyDown={(e) => { if (e.code === 'Enter') { e.preventDefault(); } }} [...]
How would you handle this? Ideally I would like that the user can also remove an option by pressing enter when a preselected option is highlighted
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am trying to implement a multiselect combobox with react. I can make it work perfectly with the mouse interaction, but with the use of the keyboard arrow + enter key, I don't manage to prevent the user from selecting an option multiple times (by pressing enter many times). Field value contains the selected option multiple times in its array.
The best work around I found for now is the deactivate the enter key, but I feel like it remove some useful functionnality :
<Combobox.Input onKeyDown={(e) => { if (e.code === 'Enter') { e.preventDefault(); } }} [...]
How would you handle this? Ideally I would like that the user can also remove an option by pressing enter when a preselected option is highlighted
Beta Was this translation helpful? Give feedback.
All reactions