forked from Dogfalo/materialize
-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Select accessibility #306
Merged
wuda-io
merged 5 commits into
materializecss:main
from
mauromascarenhas:select-accessibility
Nov 22, 2022
Merged
Select accessibility #306
wuda-io
merged 5 commits into
materializecss:main
from
mauromascarenhas:select-accessibility
Nov 22, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Improve select support to assistive technologies (e.g.: screen readers): - Label reference for created input: - Input element references orignal select label on init (if exists); - New "labelEl" attribute: points to original select element label. - Label state is restored on destroy (if used "for" attribute). - Add keyboard event handlers for element selection; - Add missing ARIA attributes to dropdown: - Dropdown now acts as listbox; - Dropdown is now "owned" by custom input; - Enhanced support to "optgroups". - Add missing ARIA attributes to dropdown elements: - Each element acts as a regular "option"; - Support to disabled elements; - Support to "selected" items. - Add missing ARIA attributes to custom input element: - Custom input should act as combobox; - Added relationship references (accessibility) to dropdown; - Added support to "expanded state". - Custom images are hidden from screen readers.
- Add "id" to select elements + "for" references in labels; - Added accessibility tests to spec.
- Replaced "$el" by "el" in _setupDropdown.
Update select docs so as to give better code samples: - Add entry to new "labelEl" attribute; - Add referenced labels to select elements: - Add id to select elements (also in code samples); - Add "for" attribute to labels (also in code samples).
- Option group names are no longer focusable by default.
wuda-io
approved these changes
Nov 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
wuda-io
pushed a commit
that referenced
this pull request
Nov 24, 2022
Smankusors
added a commit
that referenced
this pull request
Nov 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
Resolved some semantic issues in select component so as to enhance performance of assistive technologies (e.g.: screen readers).
In spite of not affecting existing projects, this PR must improve the component's overall accessibility concerns, since it fixes some HTML semantic issues (for assistive technologies) and improves keyboard navigation, in addition to better semantics in code samples available in the docs.
Summary:
NB.: Although this PR should solve semantic-wise issues with assistive technologies, select components are still affected by the lack of "focus style" as discribed in #81.
Screenshots (if appropriate) or codepen:
Here are some screenshots of how the select component is detected by assistive technologies:
Single select
Multiple select
Select with optgroup
Types of changes
Checklist: