sanusart / react-dropdown-select

Customisable dropdown select for react
https://react-dropdown-select.netlify.app/
MIT License
349 stars 83 forks source link

Open select with enter key #300

Open darrensw777 opened 10 months ago

darrensw777 commented 10 months ago

Is there a way to open the dropdown with the enter key?

I've seen this example but would prefer a functional component way as opposed to a class: https://codesandbox.io/s/open-on-top-w1yr0 - also, this works well, but when tabbing to the dropdown again, it opens automatically on focus, which is probably not the desired effect.

sanusart commented 10 months ago

It should also work with functional. It does not matter. Regarding the tabbing - it is only happening because in the example there is only one focusable component on the page.

On Thu, Oct 19, 2023 at 10:47 AM darrensw777 @.***> wrote:

Is there a way to open the dropdown with the enter key?

I've seen this example but would prefer a functional component way as opposed to a class: https://codesandbox.io/s/open-on-top-w1yr0 - also, this works well, but when tabbing to the dropdown again, it opens automatically on focus, which is probably not the desired effect.

— Reply to this email directly, view it on GitHub https://github.com/sanusart/react-dropdown-select/issues/300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACBLRRV7CBX2UOOBO6MHVLYADLKPAVCNFSM6AAAAAA6GXLQP6VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TCNJRG4ZDCMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

darrensw777 commented 10 months ago

Please take a look at: https://codesandbox.io/s/open-on-top-forked-z98kxm

When I tab to the select I cannot get out, meaning, carry on using tab to the next input. When I tab back to the select it automatically opens.