Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(autocomplete): improve implementation of aria-activedescen… (#11743)
Browse files Browse the repository at this point in the history
- allow screen readers to do more and us to do less
  - remove extra calls to announce the item that is visually focused
  - remove tests for these extra live announcements
  - give every option an id for use with `aria-activedescendant`
  - use the `selected` class for styling and finding the active option
- implement recommendations from a11y guides
  - add the clear button to the tab order
  - change input type to `text`
  - always define a `name` attribute
- when the popup isn't expanded
  - `aria-owns` and `aria-activedescendant` shouldn't be defined
- when the autocomplete is disabled
  - `aria-autocomplete` and `aria-role` shouldn't be defined
  - `aria-haspopup` should be false
- add md-autocomplete-suggestion class for styling instead of using `li`
- add `md-autoselect` to the dialog demo for help w/ manual testing
- remove overly verbose `aria-describedby` from basic demo
- mark `md-icons` in `md-item-templates` of autocomplete demos as hidden
- update demos to use `md-escape-options="clear"` for better a11y

Fixes #11742

(cherry picked from commit 8c159aa)
  • Loading branch information
Splaktar authored and jelbourn committed Jan 5, 2022
1 parent 187226e commit 1bb6fbb
Show file tree
Hide file tree
Showing 14 changed files with 494 additions and 110 deletions.
4 changes: 2 additions & 2 deletions src/components/autocomplete/autocomplete-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ md-autocomplete.md-THEME_NAME-theme {
.md-autocomplete-suggestions-container.md-THEME_NAME-theme,
.md-autocomplete-standard-list-container.md-THEME_NAME-theme {
background: '{{background-hue-1}}';
li {
.md-autocomplete-suggestion {
color: '{{foreground-1}}';
&:hover,
&#selected_option {
&.selected {
background: '{{background-500-0.18}}';
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/autocomplete/autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ md-autocomplete {
input {
border: 1px solid $border-color;
}
li:focus {
.md-autocomplete-suggestion:focus {
color: #fff;
}
}
Expand Down Expand Up @@ -214,7 +214,7 @@ md-autocomplete {
list-style: none;
padding: 0;

li {
.md-autocomplete-suggestion {
font-size: 14px;
overflow: hidden;
padding: 0 15px;
Expand Down
Loading

0 comments on commit 1bb6fbb

Please sign in to comment.