File tree 9 files changed +45
-17
lines changed
9 files changed +45
-17
lines changed Original file line number Diff line number Diff line change 40
40
.mdc-button__label {
41
41
z-index : 1 ;
42
42
}
43
+
44
+ // The focus indicator should match the bounds of the entire button.
45
+ .mat-mdc-focus-indicator {
46
+ @include mat-fill ();
47
+ }
43
48
}
44
49
45
50
// MDC's disabled buttons define a default cursor with pointer-events none. However, they select
Original file line number Diff line number Diff line change 2
2
@import ' ../../material/core/style/layout-common' ;
3
3
@import ' ../../material/core/focus-indicators/focus-indicators' ;
4
4
5
-
6
5
/// Mixin that turns on strong focus indicators.
7
6
///
8
7
/// @example
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' ;
17
18
@include cdk-a11y ();
18
19
@include cdk-overlay ();
19
20
@include cdk-text-field ();
21
+
22
+ @include _mat-strong-focus-indicators-positioning ();
23
+ @include _mat-mdc-core ();
20
24
}
21
25
22
26
@mixin mat-core-color ($config-or-theme ) {
67
71
}
68
72
}
69
73
}
74
+
75
+ // Mixin that renders all of the core MDC styles. Private mixin included with `mat-core`.
76
+ @mixin _mat-mdc-core () {
77
+ @include _mat-mdc-strong-focus-indicators-positioning ();
78
+ }
79
+
80
+ // Mixin that ensures focus indicator host elements are positioned so that the focus indicator
81
+ // pseudo element within is positioned relative to the host. Private mixin included within
82
+ // `_mat-mdc-core`.
83
+ @mixin _mat-mdc-strong-focus-indicators-positioning () {
84
+ .mat-mdc-focus-indicator {
85
+ position : relative ;
86
+ }
87
+ }
Original file line number Diff line number Diff line change 45
45
margin : - ($border-width + 2px );
46
46
}
47
47
48
- .mat-focus-indicator.mat-stroked-button ::before {
48
+ .mat-focus-indicator.mat-stroked-button ::before ,
49
+ .mat-focus-indicator.mat-calendar-body-cell-content ::before {
49
50
margin : - ($border-width + 3px );
50
51
}
51
52
52
- .mat-focus-indicator.mat-calendar-body-cell ::before {
53
- margin : - $border-width ;
54
- }
55
-
56
53
.mat-focus-indicator.mat-tab-link ::before ,
57
54
.mat-focus-indicator.mat-tab-label ::before {
58
55
margin : 5px ;
71
68
// is present.
72
69
.mat-focus-indicator.mat-option.mat-active ::before ,
73
70
74
- // The focus indicator in the calendar is placed on an element inside the cell.
75
- .mat-calendar-body-active .mat-focus-indicator ::before ,
71
+ // For calendar cells, render the focus indicator when the parent cell is
72
+ // focused.
73
+ .mat-calendar-body-cell :focus .mat-focus-indicator ::before ,
76
74
77
75
// For all other components, render the focus indicator on focus.
78
76
.mat-focus-indicator :focus ::before {
122
120
}
123
121
}
124
122
}
123
+
124
+ // Mixin that ensures focus indicator host elements are positioned so that the focus indicator
125
+ // pseudo element within is positioned relative to the host. Private mixin included within
126
+ // `mat-core`.
127
+ @mixin _mat-strong-focus-indicators-positioning () {
128
+ .mat-focus-indicator {
129
+ position : relative ;
130
+ }
131
+ }
Original file line number Diff line number Diff line change @@ -153,7 +153,6 @@ $mat-calendar-range-end-body-cell-size:
153
153
}
154
154
155
155
.mat-calendar-body-cell-content {
156
- position : absolute ;
157
156
top : $mat-calendar-body-cell-content-margin ;
158
157
left : $mat-calendar-body-cell-content-margin ;
159
158
z-index : 1 ;
@@ -175,6 +174,12 @@ $mat-calendar-range-end-body-cell-size:
175
174
// Choosing a value clearly larger than the height ensures we get the correct capsule shape.
176
175
border-radius : $mat-calendar-body-cell-radius ;
177
176
177
+ // Increase specificity because focus indicator styles are part of the `mat-core` mixin and can
178
+ // potentially overwrite the absolute position of the container.
179
+ & .mat-focus-indicator {
180
+ position : absolute ;
181
+ }
182
+
178
183
@include cdk-high-contrast (active , off) {
179
184
border : none ;
180
185
}
Original file line number Diff line number Diff line change 6
6
align-items : center ;
7
7
padding : 0 24px ;
8
8
border-radius : inherit ;
9
- position : relative ; // Necessary for the strong focus indication.
10
9
transition : height $mat-expansion-panel-header-transition ;
11
10
12
11
// If the `NoopAnimationsModule` is used, disable the height transition.
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