You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing an issue with focus management in the Dialog component when using Headless UI in a Nuxt 3 project. When I open a dialog and then close it, the focus is not reset to the button that opened the dialog. Instead, the focus seems to be lost, and the last focused item appears to be the close button inside the dialog, even though the button no longer exists in the DOM.
Steps to Reproduce
🛠️ Create a Nuxt 3 project using the latest version.
📦 Install Headless UI (latest version).
📄 Use the Dialog component as provided in the documentation examples.
🔘 Open the dialog by clicking a button.
❌ Close the dialog.
Expected Behavior
After closing the dialog, the focus should be reset to the button that triggered the dialog.
Actual Behavior
The focus is lost, and the last focused item is the close button inside the dialog, which no longer exists.
Code Example
Here is a minimal reproducible example (POC) demonstrating the issue: GitHub Repository
I noticed that if I use the :open="isOpen" prop on the Dialog component, the focus is maintained correctly, but the closing transition is interrupted and does not work smoothly.
Screenshots/Videos
Screen.Recording.2024-10-18.at.16.14.42.mov
The text was updated successfully, but these errors were encountered:
@RobinMalfait I would like to ask you for a feedback or someone that we can ask for more info. This issue is important because is breaking accessibility for users that use screen readers or users that navigate with keyboard
Description
I'm experiencing an issue with focus management in the Dialog component when using Headless UI in a Nuxt 3 project. When I open a dialog and then close it, the focus is not reset to the button that opened the dialog. Instead, the focus seems to be lost, and the last focused item appears to be the close button inside the dialog, even though the button no longer exists in the DOM.
Steps to Reproduce
🛠️ Create a Nuxt 3 project using the latest version.
📦 Install Headless UI (latest version).
📄 Use the Dialog component as provided in the documentation examples.
🔘 Open the dialog by clicking a button.
❌ Close the dialog.
Expected Behavior
After closing the dialog, the focus should be reset to the button that triggered the dialog.
Actual Behavior
The focus is lost, and the last focused item is the close button inside the dialog, which no longer exists.
Code Example
Here is a minimal reproducible example (POC) demonstrating the issue:
GitHub Repository
Live demo: Netlify Deployment
Workaround
I noticed that if I use the :open="isOpen" prop on the Dialog component, the focus is maintained correctly, but the closing transition is interrupted and does not work smoothly.
Screenshots/Videos
Screen.Recording.2024-10-18.at.16.14.42.mov
The text was updated successfully, but these errors were encountered: