Skip to content

Commit

Permalink
fix(material/select): empty space read out by VoiceOver on Chrome (#2…
Browse files Browse the repository at this point in the history
…4741)

We use an empty space to prevent the select from collapsing when it doesn't have a value, but the approach we were using was being read out as a blank space by VoiceOver on Chrome. These changes switch to using `visibility: hidden` so that it isn't read out.

Fixes #24731.

(cherry picked from commit 333f3a4)
  • Loading branch information
crisbeto authored and amysorto committed Apr 12, 2022
1 parent 6c65b1d commit 68c5e87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/material-experimental/mdc-select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ $scale: 0.75 !default;
content: ' ';
white-space: pre;
width: 1px;

// Prevents some browsers from rendering the element in high contrast mode.
display: inline-block;
opacity: 0;

// Prevents some browsers from rendering the element in high contrast mode. Use `visibility`
// instead of `opacity` since VoiceOver + Chrome still reads out the space with the latter.
visibility: hidden;
}
7 changes: 4 additions & 3 deletions src/material/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ $placeholder-arrow-space: 2 * ($arrow-size + $arrow-margin);
content: ' ';
white-space: pre;
width: 1px;

// Prevents some browsers from rendering the element in high contrast mode.
display: inline-block;
opacity: 0;

// Prevents some browsers from rendering the element in high contrast mode. Use `visibility`
// instead of `opacity` since VoiceOver + Chrome still reads out the space with the latter.
visibility: hidden;
}

0 comments on commit 68c5e87

Please sign in to comment.