Skip to content

Commit 0276784

Browse files
authored
fix(material/select): NVDA reading out table when opening select on Chrome (#23446)
The `mat-select` trigger element has an `aria-owns` pointing to the overlay and `display: inline-table` in its CSS. The combination of these two causes Chrome to infer the element as a `table` which results in NVDA reading out "table" any time a select is opened. These changes resolve the issue by using flexbox to lay out the select trigger instead. Fixes #21480.
1 parent 3deca24 commit 0276784

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/material-experimental/mdc-select/select.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ $scale: 0.75 !default;
2525
}
2626

2727
.mat-mdc-select-trigger {
28-
display: inline-table;
28+
display: inline-flex;
29+
align-items: center;
2930
cursor: pointer;
3031
position: relative;
3132
box-sizing: border-box;
33+
width: 100%;
3234

3335
.mat-mdc-select-disabled & {
3436
@include vendor-prefixes.user-select(none);
@@ -37,8 +39,6 @@ $scale: 0.75 !default;
3739
}
3840

3941
.mat-mdc-select-value {
40-
display: table-cell;
41-
max-width: 0;
4242
width: 100%;
4343
overflow: hidden;
4444
text-overflow: ellipsis;
@@ -52,8 +52,10 @@ $scale: 0.75 !default;
5252
}
5353

5454
.mat-mdc-select-arrow-wrapper {
55-
display: table-cell;
56-
vertical-align: middle;
55+
height: 24px;
56+
flex-shrink: 0;
57+
display: inline-flex;
58+
align-items: center;
5759

5860
// When used in a box appearance form-field the arrow should be shifted up 40%.
5961
.mat-form-field-appearance-fill & {

src/material/select/select.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ $placeholder-arrow-space: 2 * ($arrow-size + $arrow-margin);
1919
}
2020

2121
.mat-select-trigger {
22-
display: inline-table;
22+
display: inline-flex;
23+
align-items: center;
2324
cursor: pointer;
2425
position: relative;
2526
box-sizing: border-box;
27+
width: 100%;
2628

2729
.mat-select-disabled & {
2830
@include vendor-prefixes.user-select(none);
@@ -31,8 +33,6 @@ $placeholder-arrow-space: 2 * ($arrow-size + $arrow-margin);
3133
}
3234

3335
.mat-select-value {
34-
display: table-cell;
35-
max-width: 0;
3636
width: 100%;
3737
overflow: hidden;
3838
text-overflow: ellipsis;
@@ -44,8 +44,10 @@ $placeholder-arrow-space: 2 * ($arrow-size + $arrow-margin);
4444
}
4545

4646
.mat-select-arrow-wrapper {
47-
display: table-cell;
48-
vertical-align: middle;
47+
height: 16px;
48+
flex-shrink: 0;
49+
display: inline-flex;
50+
align-items: center;
4951

5052
// When used in a box appearance form-field the arrow should be shifted up 50%.
5153
.mat-form-field-appearance-fill & {

0 commit comments

Comments
 (0)