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

Data Focus bug in the Toggle Group component #2190

Open
rsa2135 opened this issue Jan 26, 2025 · 0 comments
Open

Data Focus bug in the Toggle Group component #2190

rsa2135 opened this issue Jan 26, 2025 · 0 comments

Comments

@rsa2135
Copy link

rsa2135 commented Jan 26, 2025

🐛 Bug report

The data-focus attribute on the Toggle Group's root element and currently focused item are not removed on blur.

💥 Steps to reproduce

  1. Go to the the ZagJS Toggle Group's Component documentation page
  2. Tab in and out of the Toggle Group and via the element inspector see that the data-focus attribute is not removed upon blur (screen capture below)

💻 Link to reproduction

https://zagjs.com/components/react/toggle-group

🧐 Expected behavior

data-focus should be removed from both the root element and the currently focused item once the component has lost focus

🧭 Possible Solution

I believe simply adding the "clearFocusedId" action to the ROOT.BLUR event would solve the issue:

focused: {
    on: {
        "ROOT.BLUR": {
            target: "idle",
            actions: ["clearIsTabbingBackward", "clearFocusedId"],
        },
      ...
}

🌍 System information

Software Version(s)
Zag Version Latest
Browser Chrome
Operating System MacOS

📝 Additional information

toggle_group_data_focus.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant