Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some suggestions #274

Closed
asharonbaltazar opened this issue Jul 22, 2021 · 9 comments
Closed

Some suggestions #274

asharonbaltazar opened this issue Jul 22, 2021 · 9 comments

Comments

@asharonbaltazar
Copy link

asharonbaltazar commented Jul 22, 2021

Accidentally pressed enter.

Edit: I'm liking this library, due to its simplicity in setting up a working dropdown menu. However, two things:

  1. I was thinking about whether you can extend this hook to include all sorts of elements, not just buttons or anchor elements.
  2. Shouldn't the esc key close the dropdown? Isn't that an accessibility feature?

Otherwise, all good! Thanks so much.

@corymharper
Copy link
Contributor

Hi @asharonbaltazar , thanks for the interest in our package!

Towards your first point, there are two open issues, #69 and #174 that are related to that, but nobody is currently working on them to my knowledge.

Towards your second point, the escape key does close the dropdown menu, and certainly is part of the accessibility controls, you should be able to see that in action on the demo page: https://sparksuite.github.io/react-accessible-dropdown-menu-hook/demo/

If you have seen it not having that behavior and can describe how to reproduce it, it would be great if you could open an issue describing the bug so we can fix it.

@asharonbaltazar
Copy link
Author

Thanks for the response.

Sure, I'll open a ticket if I can recreate it.

@WesCossick
Copy link
Member

@corymharper If I click the button (with a mouse), and then immediately hit the escape key, it doesn't close. Technically focus is on the button at that point, not within the menu. Should that close the menu though?

@corymharper
Copy link
Contributor

@corymharper If I click the button (with a mouse), and then immediately hit the escape key, it doesn't close. Technically focus is on the button at that point, not within the menu. Should that close the menu though?

I think this might be a bug, when the menu opens the first menu item should receive focus, it appears that only happens when it is opened via keyboard controls.

@WesCossick
Copy link
Member

when the menu opens the first menu item should receive focus, it appears that only happens when it is opened via keyboard controls.

I think that's intentional? I believe we don't want a focus ring to appear around the first menu item if the button is clicked (rather than opened with a keyboard key).

@WesCossick
Copy link
Member

Yeah, take a look at: #63

@corymharper
Copy link
Contributor

Yeah, take a look at: #63

I see, maybe we should alter the behavior slightly such that the menu will close if focus is on the menu button and escape is pressed.

@corymharper
Copy link
Contributor

At least one of the menus mentioned in #63 does the same thing.

@WesCossick
Copy link
Member

maybe we should alter the behavior slightly such that the menu will close if focus is on the menu button and escape is pressed.

That seems pretty reasonable. Let's do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants