angular / angular/components

bug(slide-toggle): no remaining focus if clicked on non active toggle

Open
#26,489 1 comment 1 reaction 0 assignees View on GitHub
area: material/slide-toggle P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

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

if a non focused toggle is clicked, there is no remaining focus - bad if keyboard control is used afterwards.
However if the label is clicked instead, the remaining focus works.
![toggle-focus](https://user-images.githubusercontent.com/27373333/214414034-91364c13-cf8f-4130-843d-a09f6f17f40a.gif)

### Reproduction

Steps to reproduce:
1. https://material.angular.io/components/slide-toggle/overview
2. click on not focused toggle vs click on not focused label

### Expected Behavior

remaining focus should appear on click on a non focused toggle

### Actual Behavior

no remaining focus on click on a not already focused toggle

### Environment

- Angular: 15.1.1
- CDK/Material: 15.1.1
- Browser(s): all
- Operating System (e.g. Windows, macOS, Ubuntu): all

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior at the slide-toggle overview URL by comparing a click on an unfocused toggle with a click on its label. Trace the slide-toggle focus handling and verify that clicking a non-focused toggle leaves visible keyboard focus, while preserving the existing label behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.