Skip to content

bug(Button Toggle): Template-driven form not focusable #30097

Closed
@BojanSlavkovskii

Description

@BojanSlavkovskii

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

Up until v18

Description

On Button Toggle, in the examples with forms, the Reactive form is working fine but the "Template-driven form" is not focusable, when you try to tab into it, it just skips it.
All buttons in there has tabindex="-1" where in reactive-form only the first button has tabindex="0", even without any control ( formControl or ngModel ) it works fine and tabindex on the first button is 0 (if nothing is selected).
If there is anything selected when using ngModel, then it works fine as the other two (with formControl and without any control).

UPDATE: If there is button that reset the formControl, you also cannot access the toggle-button.

Reproduction

Material link: https://material.angular.io/components/button-toggle/examples
Steps to reproduce:

  1. Go to the second example.
  2. Tab into it, and try focusing the first button-toggle-group ( Template-driven form ) without pre-selecting value.

Expected Behavior

Expected behavior is to behave as the one that has FormControl and the one that has nothing in it. It's expected the first button to be focused if value isn't selected.

Actual Behavior

Button-toggle is not focusable if there isn't any selected value like without using ngModel.

Environment

  • Angular: 19
  • CDK/Material: 19
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: material/button-toggle

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions