File tree Expand file tree Collapse file tree 9 files changed +45
-17
lines changed Expand file tree Collapse file tree 9 files changed +45
-17
lines changed Original file line number Diff line number Diff line change 4040 .mdc-button__label {
4141 z-index : 1 ;
4242 }
43+
44+ // The focus indicator should match the bounds of the entire button.
45+ .mat-mdc-focus-indicator {
46+ @include mat-fill ();
47+ }
4348}
4449
4550// 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 22@import ' ../../material/core/style/layout-common' ;
33@import ' ../../material/core/focus-indicators/focus-indicators' ;
44
5-
65/// Mixin that turns on strong focus indicators.
76///
87/// @example
Original file line number Diff line number Diff line change 55// Core styles that can be used to apply material design treatments to any element.
66@import ' ./style/elevation' ;
77@import ' ./ripple/ripple' ;
8+ @import ' ./focus-indicators/focus-indicators' ;
89@import ' ./option/option-theme' ;
910@import ' ./option/optgroup-theme' ;
1011@import ' ./selection/pseudo-checkbox/pseudo-checkbox-theme' ;
1718 @include cdk-a11y ();
1819 @include cdk-overlay ();
1920 @include cdk-text-field ();
21+
22+ @include _mat-strong-focus-indicators-positioning ();
23+ @include _mat-mdc-core ();
2024}
2125
2226@mixin mat-core-color ($config-or-theme ) {
6771 }
6872 }
6973}
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 4545 margin : - ($border-width + 2px );
4646 }
4747
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 {
4950 margin : - ($border-width + 3px );
5051 }
5152
52- .mat-focus-indicator.mat-calendar-body-cell ::before {
53- margin : - $border-width ;
54- }
55-
5653 .mat-focus-indicator.mat-tab-link ::before ,
5754 .mat-focus-indicator.mat-tab-label ::before {
5855 margin : 5px ;
7168 // is present.
7269 .mat-focus-indicator.mat-option.mat-active ::before ,
7370
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 ,
7674
7775 // For all other components, render the focus indicator on focus.
7876 .mat-focus-indicator :focus ::before {
122120 }
123121 }
124122}
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:
153153}
154154
155155.mat-calendar-body-cell-content {
156- position : absolute ;
157156 top : $mat-calendar-body-cell-content-margin ;
158157 left : $mat-calendar-body-cell-content-margin ;
159158 z-index : 1 ;
@@ -175,6 +174,12 @@ $mat-calendar-range-end-body-cell-size:
175174 // Choosing a value clearly larger than the height ensures we get the correct capsule shape.
176175 border-radius : $mat-calendar-body-cell-radius ;
177176
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+
178183 @include cdk-high-contrast (active , off) {
179184 border : none ;
180185 }
Original file line number Diff line number Diff line change 66 align-items : center ;
77 padding : 0 24px ;
88 border-radius : inherit ;
9- position : relative ; // Necessary for the strong focus indication.
109 transition : height $mat-expansion-panel-header-transition ;
1110
1211 // If the `NoopAnimationsModule` is used, disable the height transition.
Original file line number Diff line number Diff line change 1313 transition : margin 225ms $mat-fast-out-slow-in-timing-function ,
1414 mat-elevation-transition-property-value ();
1515
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.
1718 position : relative ;
1819
1920 .mat-accordion & {
Original file line number Diff line number Diff line change @@ -48,9 +48,6 @@ $mat-list-item-inset-divider-offset: 72px;
4848 width : 100% ;
4949 padding : 0 ;
5050
51- // Required for focus indicator.
52- position : relative ;
53-
5451 .mat-list-item-content {
5552 display : flex ;
5653 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;
3232 font : inherit ;
3333 color : currentColor ;
3434
35- // Required for focus indicator.
36- position : relative ;
37-
3835 // Usually we could rely on the arrow showing up to be focus indication, but if a header is
3936 // active, the arrow will always be shown so the user has no way of telling the difference.
4037 [mat-sort-header ].cdk-keyboard-focused & ,
You can’t perform that action at this time.
0 commit comments