-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Disabled Tag
can be removed with keyboard nav
#7080
Comments
This appears to be fixed on main and will be in the next release. |
Thanks for looking into this. I'm still able to reproduce the issue on the nightly build. It only happens when all the remaining Tags are disabled. |
Awesome, thank you for providing that. I can reproduce it now. For whoever fixes this, the focus shouldn't go to the last Tag; it should go to the group as it does for forward navigation. In addition, hitting delete should also not remove the tag, but theoretically, if we fix the first issue, the other should become not possible (though another bug could make it so, so it is better to defensively handle that if possible) |
Can I try it? |
Provide a general summary of the issue here
When a React Aria Components
TagList
contains only disabled items, the last disabledTag
can be removed by tabbing backwards into the list and pressing delete.🤔 Expected Behavior?
Disabled
Tag
s should not be removed using the delete key.😯 Current Behavior
Disabled
Tag
s can be focused by tabbing backwards, then removed by pressing delete.See gif and CodeSandbox below
💁 Possible Solution
This seems to be caused by a combination of two issues in
useTag
:Tag
s do not settabIndex
to -1onKeyDown
event handler does not check if the tag is disabled before callingonRemove
🔦 Context
I can work around this by validating the removed Tag IDs in my
onRemove
event handler, but it would be nice if this worked without needing validation, like how the inner remove button automatically hasisDisabled
set to prevent removing disabled Tags via clicking.🖥️ Steps to Reproduce
https://codesandbox.io/p/sandbox/loving-golick-8mnndy
Version
"react-aria-components": "1.3.3"
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
macOS Sonoma 14.5
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: