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

Commit 8c159aa

Browse files
Splaktarmmalerba
authored andcommitted
fix(autocomplete): improve implementation of aria-activedescen… (#11743)
- 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
1 parent e9e4647 commit 8c159aa

File tree

14 files changed

+494
-110
lines changed

14 files changed

+494
-110
lines changed

src/components/autocomplete/autocomplete-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ md-autocomplete.md-THEME_NAME-theme {
4949
.md-autocomplete-suggestions-container.md-THEME_NAME-theme,
5050
.md-autocomplete-standard-list-container.md-THEME_NAME-theme {
5151
background: '{{background-hue-1}}';
52-
li {
52+
.md-autocomplete-suggestion {
5353
color: '{{foreground-1}}';
5454
&:hover,
55-
&#selected_option {
55+
&.selected {
5656
background: '{{background-500-0.18}}';
5757
}
5858
}

src/components/autocomplete/autocomplete.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ md-autocomplete {
174174
input {
175175
border: 1px solid $border-color;
176176
}
177-
li:focus {
177+
.md-autocomplete-suggestion:focus {
178178
color: #fff;
179179
}
180180
}
@@ -214,7 +214,7 @@ md-autocomplete {
214214
list-style: none;
215215
padding: 0;
216216

217-
li {
217+
.md-autocomplete-suggestion {
218218
font-size: 14px;
219219
overflow: hidden;
220220
padding: 0 15px;

0 commit comments

Comments
 (0)