-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(cdk/a11y): Refactor focus indicator theme mixins to match other theme mixins #22427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,21 @@ | ||
| @use 'sass:meta'; | ||
| @use 'sass:map'; | ||
| @use '../../material/core/theming/theming'; | ||
|
|
||
| // Mixin that applies the border color for the focus indicators. | ||
| @mixin _border-color($color) { | ||
| .mat-mdc-focus-indicator::before { | ||
| border-color: $color; | ||
| } | ||
| } | ||
|
|
||
| @mixin color($config-or-theme) { | ||
| $config: theming.get-color-config($config-or-theme); | ||
| $border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
| @include _border-color($border-color); | ||
| } | ||
|
|
||
| /// Mixin that sets the color of the focus indicators. | ||
| /// | ||
| /// @param {color|map} $theme-or-color | ||
| /// If theme, focus indicators are set to the primary color of the theme. If | ||
| /// color, focus indicators are set to that color. | ||
| /// | ||
| /// @example | ||
| /// .demo-dark-theme { | ||
| /// @include mat-mdc-strong-focus-indicators-theme($dark-theme-map); | ||
| /// } | ||
| /// | ||
| /// @example | ||
| /// .demo-red-theme { | ||
| /// @include mat-mdc-strong-focus-indicators-theme(#f00); | ||
| /// } | ||
| // stylelint-disable-next-line material/theme-mixin-api | ||
| @mixin theme($theme-or-color) { | ||
| @if meta.type-of($theme-or-color) != 'map' { | ||
| @include _border-color($theme-or-color); | ||
| .mat-mdc-focus-indicator::before { | ||
| border-color: $border-color; | ||
| } | ||
| @else { | ||
| $theme: theming.private-legacy-get-theme($theme-or-color); | ||
| @include theming.private-check-duplicate-theme-styles($theme, | ||
| 'mat-mdc-strong-focus-indicators') { | ||
| $color: theming.get-color-config($theme); | ||
| @if $color != null { | ||
| @include color($color); | ||
| } | ||
| } | ||
|
|
||
| @mixin theme($theme-or-color-config) { | ||
| $theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
| @include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-focus-indicators') { | ||
| $color: theming.get-color-config($theme); | ||
| @if $color != null { | ||
| @include color($color); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,21 @@ | ||
| @use 'sass:meta'; | ||
| @use 'sass:map'; | ||
| @use '../theming/theming'; | ||
|
|
||
| @mixin color($config-or-theme) { | ||
| $config: theming.get-color-config($config-or-theme); | ||
| $border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
| @include _border-color($border-color); | ||
| } | ||
|
|
||
| /// Mixin that sets the color of the focus indicators. | ||
| /// | ||
| /// @param {color|map} $theme-or-color | ||
| /// If theme, focus indicators are set to the primary color of the theme. If | ||
| /// color, focus indicators are set to that color. | ||
| /// | ||
| /// @example | ||
| /// .demo-dark-theme { | ||
| /// @include mat-strong-focus-indicators-theme($dark-theme-map); | ||
| /// } | ||
| /// | ||
| /// @example | ||
| /// .demo-red-theme { | ||
| /// @include mat-strong-focus-indicators-theme(#f00); | ||
| /// } | ||
| // stylelint-disable-next-line material/theme-mixin-api | ||
| @mixin theme($theme-or-color) { | ||
| @if meta.type-of($theme-or-color) != 'map' { | ||
| @include _border-color($theme-or-color); | ||
| } | ||
| @else { | ||
| $theme: theming.private-legacy-get-theme($theme-or-color); | ||
| @include theming.private-check-duplicate-theme-styles($theme, 'mat-strong-focus-indicators') { | ||
| $color: theming.get-color-config($theme); | ||
| @if $color != null { | ||
| @include color($color); | ||
| } | ||
| } | ||
| .mat-focus-indicator::before { | ||
| border-color: $border-color; | ||
| } | ||
| } | ||
|
|
||
| // Mixin that applies the border color for the focus indicators. | ||
| @mixin _border-color($color) { | ||
| .mat-focus-indicator::before { | ||
| border-color: $color; | ||
| @mixin theme($theme-or-color-config) { | ||
| $theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
| @include theming.private-check-duplicate-theme-styles($theme, 'mat-focus-indicators') { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: The id to
|
||
| $color: theming.get-color-config($theme); | ||
| @if $color != null { | ||
| @include color($color); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug, AFAICT.