File tree Expand file tree Collapse file tree 10 files changed +46
-35
lines changed Expand file tree Collapse file tree 10 files changed +46
-35
lines changed Original file line number Diff line number Diff line change 15
15
@include angular-material-mdc-typography ();
16
16
@include mat-edit-typography (mat-typography-config ());
17
17
18
+ // MDC does not yet have an equivalent to `mat-core` to include this in.
19
+ @include mat-mdc-strong-focus-indicators-base ();
20
+
18
21
// Include base styles for strong focus indicators.
19
22
.demo-strong-focus {
20
23
@include mat-strong-focus-indicators ();
Original file line number Diff line number Diff line change 43
43
44
44
// The focus indicator should match the bounds of the entire button.
45
45
.mat-mdc-focus-indicator {
46
- @include mat-fill ;
46
+ @include mat-fill () ;
47
47
}
48
48
}
49
49
Original file line number Diff line number Diff line change @@ -234,16 +234,12 @@ $mat-typography-level-mappings: (
234
234
$border-radius : map-get ($config , border-radius );
235
235
236
236
// Base styles for focus indicators.
237
- .mat-mdc-focus-indicator {
238
- position : relative ;
239
-
240
- & ::before {
241
- @include mat-fill ();
242
- box-sizing : border-box ;
243
- pointer-events : none ;
244
- border : $border-width $border-style transparent ;
245
- border-radius : $border-radius ;
246
- }
237
+ .mat-mdc-focus-indicator ::before {
238
+ @include mat-fill ();
239
+ box-sizing : border-box ;
240
+ pointer-events : none ;
241
+ border : $border-width $border-style transparent ;
242
+ border-radius : $border-radius ;
247
243
}
248
244
249
245
// By default, all focus indicators are flush with the bounding box of their
@@ -313,3 +309,13 @@ $mat-typography-level-mappings: (
313
309
$theme-or-color );
314
310
}
315
311
}
312
+
313
+ /// Mixin that applies base styles required for focus indicators to render appropriately.
314
+ /// Should be included once in your app.
315
+ @mixin mat-mdc-strong-focus-indicators-base () {
316
+ // Ensure that focus indicator host elements are positioned so that the focus indicator
317
+ // pseudo element within is positioned relatively to the host.
318
+ .mat-mdc-focus-indicator {
319
+ position : relative ;
320
+ }
321
+ }
Original file line number Diff line number Diff line change 5
5
// Core styles that can be used to apply material design treatments to any element.
6
6
@import ' style/elevation' ;
7
7
@import ' ripple/ripple' ;
8
+ @import ' focus-indicators/focus-indicators' ;
8
9
@import ' option/option-theme' ;
9
10
@import ' option/optgroup-theme' ;
10
11
@import ' selection/pseudo-checkbox/pseudo-checkbox-theme' ;
14
15
@mixin mat-core ($typography-config : null) {
15
16
@include angular-material-typography ($typography-config );
16
17
@include mat-ripple ();
18
+ @include mat-strong-focus-indicators-base ();
17
19
@include cdk-a11y ();
18
20
@include cdk-overlay ();
19
21
@include cdk-text-field ();
Original file line number Diff line number Diff line change 22
22
$border-radius : map-get ($config , border-radius );
23
23
24
24
// Base styles for focus indicators.
25
- .mat-focus-indicator {
26
- position : relative ;
27
-
28
- & ::before {
29
- @include mat-fill ();
30
- box-sizing : border-box ;
31
- pointer-events : none ;
32
- border : $border-width $border-style transparent ;
33
- border-radius : $border-radius ;
34
- }
25
+ .mat-focus-indicator ::before {
26
+ @include mat-fill ();
27
+ box-sizing : border-box ;
28
+ pointer-events : none ;
29
+ border : $border-width $border-style transparent ;
30
+ border-radius : $border-radius ;
35
31
}
36
32
37
33
// By default, all focus indicators are flush with the bounding box of their
103
99
$theme-or-color );
104
100
}
105
101
}
102
+
103
+ /// Mixin that applies base styles required for focus indicators to render appropriately.
104
+ /// Automatically included within `mat-core`, should not be directly included in your app.
105
+ @mixin mat-strong-focus-indicators-base () {
106
+ // Ensure that focus indicator host elements are positioned so that the focus indicator
107
+ // pseudo element within is positioned relatively to the host.
108
+ .mat-focus-indicator {
109
+ position : relative ;
110
+ }
111
+ }
Original file line number Diff line number Diff line change @@ -152,12 +152,6 @@ $mat-calendar-range-end-body-cell-size:
152
152
cursor : default ;
153
153
}
154
154
155
- // Apply this style with additional specificity to override the focus indicator's relative
156
- // positioning.
157
- .mat-calendar-body-cell .mat-calendar-body-cell-content {
158
- position : absolute ;
159
- }
160
-
161
155
.mat-calendar-body-cell-content {
162
156
top : $mat-calendar-body-cell-content-margin ;
163
157
left : $mat-calendar-body-cell-content-margin ;
@@ -180,6 +174,12 @@ $mat-calendar-range-end-body-cell-size:
180
174
// Choosing a value clearly larger than the height ensures we get the correct capsule shape.
181
175
border-radius : $mat-calendar-body-cell-radius ;
182
176
177
+ // Apply this style with additional specificity to override the focus indicator's relative
178
+ // positioning.
179
+ .mat-calendar-body-cell & {
180
+ position : absolute ;
181
+ }
182
+
183
183
@include cdk-high-contrast (active , off) {
184
184
border : none ;
185
185
}
Original file line number Diff line number Diff line change 4
4
align-items : center ;
5
5
padding : 0 24px ;
6
6
border-radius : inherit ;
7
- position : relative ; // Necessary for the strong focus indication.
8
7
9
8
& :focus ,
10
9
& :hover {
Original file line number Diff line number Diff line change 13
13
transition : margin 225ms $mat-fast-out-slow-in-timing-function ,
14
14
mat-elevation-transition-property-value ();
15
15
16
- // Required so that the `box-shadow` works after we add `position: relative` to the header.
16
+ // Required so that the `box-shadow` works after the focus indicator relatively positions the
17
+ // header.
17
18
position : relative ;
18
19
19
20
.mat-accordion & {
Original file line number Diff line number Diff line change @@ -48,9 +48,6 @@ $mat-list-item-inset-divider-offset: 72px;
48
48
width : 100% ;
49
49
padding : 0 ;
50
50
51
- // Required for focus indicator.
52
- position : relative ;
53
-
54
51
.mat-list-item-content {
55
52
display : flex ;
56
53
flex-direction : row ;
Original file line number Diff line number Diff line change @@ -32,9 +32,6 @@ $mat-sort-header-arrow-hint-opacity: 0.38;
32
32
font : inherit ;
33
33
color : currentColor ;
34
34
35
- // Required for focus indicator.
36
- position : relative ;
37
-
38
35
// Usually we could rely on the arrow showing up to be focus indication, but if a header is
39
36
// active, the arrow will always be shown so the user has no way of telling the difference.
40
37
[mat-sort-header ].cdk-keyboard-focused & ,
You can’t perform that action at this time.
0 commit comments