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

useFocusRedirect does not handle focus leave from radio group in Popup #2257

Closed
pablobirukov opened this issue Jun 15, 2023 · 1 comment · Fixed by #2258
Closed

useFocusRedirect does not handle focus leave from radio group in Popup #2257

pablobirukov opened this issue Jun 15, 2023 · 1 comment · Fixed by #2258
Labels
bug Something isn't working

Comments

@pablobirukov
Copy link
Contributor

pablobirukov commented Jun 15, 2023

🐛 Bug Report

useFocusRedirect does not handle focus leave from Popup when a radio group is the last element in the popup

To Reproduce

Have a Popup with radio group

https://codesandbox.io/s/focus-redirect-with-radio-group-3562q2

Open popup, move focus with Tab to radio group, move focus with Tab further

Expected Behavior

Popup is to close and focus is to move to the element following Popup trigger

Radio group behaves as it's a single focusable element, spec

Actual Results

focus leaves the document as if radio group was the last focusable element in the document (which it is)

Browser (if applicable)

FF, Chrome

Link to repl or repo (highly encouraged)

https://codesandbox.io/s/focus-redirect-with-radio-group-3562q2

Error Output

Screen.Recording.2023-06-15.at.13.02.14.mov
@pablobirukov pablobirukov added the bug Something isn't working label Jun 15, 2023
@NicholasBoll
Copy link
Member

I've updated the issue to includes a code sandbox link

alanbsmith pushed a commit that referenced this issue Jun 30, 2023
Fixes: #2257

My naive approach: when radio is happens to be the last focusable element withing Popup, check whether it belongs to a radio group, and if so, ensure we handle focus leave for all radio group elements. 

[RadioButton focus management spec](https://www.w3.org/wiki/RadioButton)

[category:Components]

Release Note:
`useFocusRedirect` handles focus leave from radio group within Popup

Co-authored-by: Pavel Birukov <[email protected]>
Co-authored-by: @mannycarrera4 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants