Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The new M3 styling via including slide-toggle-overrides does not work correctly for state-overlay tokens.
:root {
@include mat.slide-toggle-overrides((
...
));
}
Also, the focus behavior seems inconsistent comparing keyboard & mouse on label to mouse on button.
(See also related ticket: #26489)
Reproduction
StackBlitz link: https://stackblitz.com/edit/g1co2sxl-wa4v2ght?file=src%2Fstyles.scss,src%2Fexample%2Fslide-toggle-configurable-example.ts
or: default Angular Material example: https://material.angular.io/components/slide-toggle/examples#slide-toggle-configurable
Steps to reproduce:
- Change the overrides in the styles.scss in the material-ui mat-slide-toggle example or the given stackblitz example
- Check out the behavior for mouse click on label
- Compare to the behavior for mouse click on button
- Compare to the behavior for interaction with tab-key
Expected Behavior
-
Color overrides: unselected-pressed-state-layer-color and selected-pressed-state-layer-color should used for active state triggered by mouse interaction on the label
-
Opacitiy overrides: hover and focus state layer opacity should be set to the values from their token overrides (unselected-hover-state-layer-opacity, selected-hover-state-layer-opacity, unselected-focus-state-layer-opacity, selected-focus-state-layer-opacity ).
-
Focus: the button should remain focused after all interactions (keyboard interaction,mouse interaction on the label, mouse interaction on the button
Actual Behavior
-
Color overrides: unselected-hover-state-layer-color and selected-hover-state-layer-color is being used for active state triggered by mouse interaction on the label
-
Opacitiy overrides: hover and focus state layer opacity are not changed by token overrides (unselected-hover-state-layer-opacity, selected-hover-state-layer-opacity, unselected-focus-state-layer-opacity, selected-focus-state-layer-opacity ). Instead a fixed value seems to be derived form a :before-:after animation.
-
Focus: the button is only focused after keyboard interaction or mouse interaction on the label, not for mouse interaction on the button (the state seems to be removed directly after the click)
Environment
- Angular: 19.2.0
- CDK/Material: 19.2.0
- Browser(s): Edge, Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows