Skip to content

Commit ba8e581

Browse files
zelliottmmalerba
authored andcommitted
Fixed bug in Sass.
1 parent d669169 commit ba8e581

File tree

1 file changed

+44
-38
lines changed

1 file changed

+44
-38
lines changed

src/material/core/focus-indicator/_focus-indicator.scss

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,64 @@
88
/// }
99

1010
@mixin mat-strong-focus-indicators() {
11-
$border-width: 2px;
11+
// Reference to the root selector, used to simplify the nested selectors
12+
// in this mixin.
13+
$root-selector: #{&};
1214

13-
// Base styles for focus indicators.
14-
& .mat-focus-indicator::before {
15-
border-radius: 4px;
16-
border: $border-width solid transparent;
17-
box-sizing: border-box;
18-
position: absolute;
19-
pointer-events: none;
20-
top: 0;
21-
right: 0;
22-
bottom: 0;
23-
left: 0;
24-
}
15+
// Border width of the focus indicators.
16+
$border-width: 2px;
2517

18+
@at-root .mat-focus-indicator {
19+
// Base styles for the focus indicators.
20+
#{$root-selector} &::before {
21+
border: $border-width solid transparent;
22+
border-radius: 4px;
23+
box-sizing: border-box;
24+
pointer-events: none;
25+
position: absolute;
26+
top: 0;
27+
right: 0;
28+
bottom: 0;
29+
left: 0;
30+
}
31+
32+
// By default, all focus indicators are flush with the bounding box of their
33+
// host element. For particular elements (listed below), default inset/offset
34+
// values are necessary to ensure that the focus indicator is sufficiently
35+
// contrastive and renders appropriately.
2636

27-
// By default, all focus indicators are flush with the bounding box of their
28-
// host element. For particular elements (listed below), default inset/offset
29-
// values are necessary to ensure that the focus indicator is sufficiently
30-
// contrastive and renders appropriately.
31-
& .mat-focus-indicator {
32-
&.mat-button-base::before,
33-
&.mat-card::before,
34-
&.mat-sort-header-button::before {
37+
#{$root-selector} &.mat-button-base::before,
38+
#{$root-selector} &.mat-card::before,
39+
#{$root-selector} &.mat-sort-header-button::before {
3540
margin: $border-width * -2;
3641
}
3742

38-
&.mat-calendar-body-cell::before {
43+
#{$root-selector} &.mat-calendar-body-cell::before {
3944
margin: $border-width * -1;
4045
}
4146

42-
&.mat-tab-link::before,
43-
&.mat-tab-label::before {
47+
#{$root-selector} &.mat-tab-link::before,
48+
#{$root-selector} &.mat-tab-label::before {
4449
margin: $border-width * 2;
4550
}
46-
}
4751

48-
// On focus, actually render the focus indicators. Defining a pseudo
49-
// element's content will cause it to render.
50-
& .mat-focus-indicator {
51-
// Checkbox, Option, Slide Toggle
52-
.cdk-focused.mat-checkbox &::before,
53-
.cdk-focused.mat-radio-button &::before,
54-
.cdk-focused.mat-slide-toggle &::before,
52+
// Render the focus indicator on focus. Defining a pseudo element's
53+
// content will cause it to render.
54+
55+
// For checkboxes, radios, and slide toggles, render the focus indicator
56+
// when the class .cdk-focused is present.
57+
#{$root-selector} .cdk-focused.mat-checkbox &::before,
58+
#{$root-selector} .cdk-focused.mat-radio-button &::before,
59+
#{$root-selector} .cdk-focused.mat-slide-toggle &::before,
5560

56-
// Option
57-
&.mat-option.mat-active::before,
61+
// For options, render the focus indicator when the class .mat-active
62+
// is present.
63+
#{$root-selector} &.mat-active.mat-option::before,
5864

59-
// All other components
60-
&:focus::before {
65+
// For all other components, render the focus indicator on focus.
66+
#{$root-selector} &:focus::before {
6167
content: '';
62-
}
68+
}
6369
}
6470
}
6571

@@ -80,7 +86,7 @@
8086
/// }
8187

8288
@mixin mat-strong-focus-indicators-theme($themeOrColor) {
83-
& .mat-focus-indicator::before {
89+
.mat-focus-indicator::before {
8490
border-color: if(
8591
type-of($themeOrColor) == 'map',
8692
mat-color(map_get($themeOrColor, primary)),

0 commit comments

Comments
 (0)