This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Fixes #116 by @sarayourfriend
Description
Adds a Dropdown component based on Vuetensils' Dropdown to make the navbar keyboard accessible.
Technical details
Heavily modifies the Vuetensils' Dropdown to accomodate a couple of things:
onFocus
prop available through the default slot. ThisonFocus
prop should be used in the@focus
for each dropdown item. This makes it possible to tab "backwards" from a subsequent navbar item. For example, in the real example of the Openverse dropdown if you Shift + Tab from the Web Extension navbar item, you should focus into the last item of the Resources dropdown, not the Resources dropdown itself.@wordpress/components
. This makes the dropdown items always appear in the DOM, making them keyboard focusable while hiding them from sighted users.Tests
If you're on macOS, ensure that you've enabled keyboard navigation in the accessibility options following the instructions here: https://www.a11yproject.com/posts/2017-12-29-macos-browser-keyboard-navigation/
After restarting your browser, you should be able to tab through the navbar items including the dropdown items. Compare this to the live site and you'll see that it was not previously possible.
There are also unit tests to ensure that the focus management works (by teseting the presence of the
visible
class on the dropdown wrapper).Checklist
Update index.md
).main
ormaster
).Developer Certificate of Origin
Developer Certificate of Origin