Skip to content

Commit d4e104a

Browse files
andrewseguinAndrew Seguin
andauthored
fix(multiple): use focus-visible for focus indicator (#32514)
Co-authored-by: Andrew Seguin <[email protected]>
1 parent a364de5 commit d4e104a

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

src/material/button/_button-base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757
}
5858

59-
&:focus > .mat-focus-indicator::before {
59+
&:focus-visible > .mat-focus-indicator::before {
6060
content: '';
6161

6262
@if ($focus-indicator-inherits-shape) {

src/material/checkbox/checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ $fallbacks: m3-checkbox.get-tokens();
105105

106106
// For checkboxes render the focus indicator when we know
107107
// the hidden input is focused (slightly different for each control).
108-
.mdc-checkbox__native-control:focus ~ .mat-focus-indicator::before {
108+
.mdc-checkbox__native-control:focus-visible ~ .mat-focus-indicator::before {
109109
content: '';
110110
}

src/material/chips/chip.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ $fallbacks: m3-chip.get-tokens();
737737

738738
// The chip has multiple focus targets so we have to put the indicator on
739739
// a separate element, rather than on the focusable element itself.
740-
.mat-mdc-chip-action:focus .mat-focus-indicator::before {
740+
.mat-mdc-chip-action:focus-visible .mat-focus-indicator::before {
741741
content: '';
742742
}
743743

src/material/core/focus-indicators/_private.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $default-border-radius: 4px;
2828

2929
// By default, render the focus indicator when the focus indicator host element takes focus.
3030
// Defining a pseudo element's content will cause it to render.
31-
&:focus::before {
31+
&:focus-visible::before {
3232
content: '';
3333
}
3434
}

src/material/datepicker/calendar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ $fallbacks: m3-datepicker.get-tokens();
132132

133133
// For calendar cells, render the focus indicator when the parent cell is
134134
// focused.
135-
.mat-calendar-body-cell:focus .mat-focus-indicator::before {
135+
.mat-calendar-body-cell:focus-visible .mat-focus-indicator::before {
136136
content: '';
137137
}
138138

src/material/list/list.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ a.mdc-list-item--activated {
131131

132132
// For list items, render the focus indicator when the parent
133133
// listem item is focused.
134-
&:focus > .mat-focus-indicator::before {
134+
&:focus-visible > .mat-focus-indicator::before {
135135
content: '';
136136
}
137137
}

src/material/stepper/step-header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $fallbacks: m3-stepper.get-tokens();
1616

1717
// Stepper headers have the focus indicator as a descendant,
1818
// because `::before` is used for other styling.
19-
&:focus .mat-focus-indicator::before {
19+
&:focus-visible .mat-focus-indicator::before {
2020
content: '';
2121
}
2222

0 commit comments

Comments
 (0)