Skip to content
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

Focus issue for radio group as first element in dialog #17876

Closed
mattharr opened this issue Dec 4, 2019 · 1 comment · Fixed by #18081
Closed

Focus issue for radio group as first element in dialog #17876

mattharr opened this issue Dec 4, 2019 · 1 comment · Fixed by #18081
Assignees
Labels
area: material/dialog area: material/radio P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mattharr
Copy link

mattharr commented Dec 4, 2019

Reproduction

I've recreated the issue here: https://stackblitz.com/edit/angular-2nkqr3-znajkf

Steps to reproduce:

  1. For the dialog opened by button 2, then select a radio option (say 'Badger')
  2. Tab through the elements to get to the Ok button.
  3. Press Tab

Expected Behavior

The focus in the radio group should be on the selected option.

Actual Behavior

The focus in the radio group is on the first option (whether it is selected or not)

Environment

Have tried this in both Firefox and Chrome

Notes

For the dialog by button 3 I have put an input control before the radio group in the tab order in the dialog, and this behaves as would be expected (tab takes you to the selected option).

I did ask about this in stackoverflow: https://stackoverflow.com/questions/59024581/radio-button-focus-in-angular-material-dialog (although I've only just put the correct tag on it), but I think its not something to be worked around with tab order.

Thanks,

Matt

@crisbeto crisbeto self-assigned this Jan 1, 2020
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jan 1, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 1, 2020
Currently all radio buttons inside a radio group have a `tabindex` of 0, unless they're disabled, and we leave it up to the browser to focus the proper button based on its selected state when the user is tabbing. This works for the most part, but it breaks down with something like our focus trap which determines which element to focus based on its `tabindex` since all buttons have the same `tabindex`. These changes fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 22, 2020
Currently all radio buttons inside a radio group have a `tabindex` of 0, unless they're disabled, and we leave it up to the browser to focus the proper button based on its selected state when the user is tabbing. This works for the most part, but it breaks down with something like our focus trap which determines which element to focus based on its `tabindex` since all buttons have the same `tabindex`. These changes fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 16, 2020
Currently all radio buttons inside a radio group have a `tabindex` of 0, unless they're disabled, and we leave it up to the browser to focus the proper button based on its selected state when the user is tabbing. This works for the most part, but it breaks down with something like our focus trap which determines which element to focus based on its `tabindex` since all buttons have the same `tabindex`. These changes fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 26, 2020
Currently all radio buttons inside a radio group have a `tabindex` of 0, unless they're
disabled, and we leave it up to the browser to focus the proper button based on its
selected state when the user is tabbing. This works for the most part, but it breaks
down with something like our focus trap which determines which element to focus based on its `tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 6, 2020
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 4, 2021
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 16, 2021
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 27, 2022
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
crisbeto added a commit that referenced this issue Mar 27, 2022
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes #17876.

(cherry picked from commit 81ff8c8)
crisbeto added a commit that referenced this issue Mar 27, 2022
Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes #17876.
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
)

Currently all radio buttons inside a radio group have a `tabindex` of 0,
unless they're disabled, and we leave it up to the browser to focus the
proper button based on its selected state when the user is tabbing.
This works for the most part, but it breaks down with something like
our focus trap which determines which element to focus based on its
`tabindex` since all buttons have the same `tabindex`. These changes
fix the issue by setting a `tabindex` of 0 only on the selected radio button.

Fixes angular#17876.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/dialog area: material/radio P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants