SelectDropdown: Fix some a11y voiceover issues #239
Merged
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.
This update fixes the a11y voiceover handling for the
SelectDropdown
component, which powers components like theFontSizePicker
.This was discovered after the integration of the
FontSizePicker
into Gutenberg:WordPress/gutenberg#27594
The solution was the adjust the render structure for the
SelectDropdown
to better accommodateuseSelect()
fromdownshift
(the same library/setup we use on thecustom-select-control
.Unfortunately, we do lose the ability to
Portal
the menu content with this adjustment. It's more important that voiceover works correctly though.We can revisit
useSelect
+ portal'ing in the future.From my experience, this doesn't seem like a very straight forward thing to do.
Other adjustments would be for the
TextInput
.It's been adjusted so that
isCommitOnBlurOrEnter
is defaulted tofalse
, matching the interaction flow for standard inputs and inputs found in the@wordpress/components
library.We can revisit the
input[type="number"]
interactions forFontSizePicker
in the future.Testing
The quickest way to test would be to visit this URL:
https://g2-git-fix-select-dropdown-a11y.itsjonq.vercel.app/iframe.html?id=components-fontsizecontrol--periodic-rerender&viewMode=story
Turn on Mac OS voiceover to ensure that the focus and selections are working as expected.
--
cc'ing @talldan