-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Composite: make items tabbable if active element gets removed #65720
Conversation
935c2e7
to
a63fada
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Flaky tests detected in 7de8ae6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11160667834
|
10a3353
to
f05512f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f05512f
to
416d500
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
31161cc
to
7de8ae6
Compare
I'll enable backporting once #65853 gets merged |
* Composite: make items tabbable when the active element is disconnected * Add unit test * Better test name * CHANGELOG --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: diegohaz <hazdiego@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 54ee0ee |
@ciampo Thanks for trying this. Is there anything noteworthy about this change that we should know before implementing it on Ariakit? Have you encountered any issues? |
I haven't encountered issues myself, not have received any reports — @afercia , do you have any feedback? |
@ciampo @diegohaz I haven't tested the progress on this fix since I reported it iin #65283 Do I get it correctly that the fix is:
If that's correct, it seems to me it's a reasonable and effective fix. |
What?
May fix #65283
This PR tweaks the behavior of the
Composite
component so that the composite widget can continue to receive keyboard focus even when its active ID doesn't correspond to an element rendered in the DOM.Why?
The fact that
Composite
can end up in a situation where the whole widget is not focusable is bad for assistive technology, and we should try to fix it.How?
Following a suggestion from the Ariakit maintainers, this PR makes all composite items tabbable if the element associated with the active ID is not connected to the store.
In this case, when the focus is moved back to the composite widget, the items will be able to receive focus. As soon as one item receives focus, all composite items will stop being tabbable and revert back to the standard behavior of a composite widget.
Review suggestions
Review commit-by-commit. The actual fix is applied in the first commit. The rest of the commits are accessories to the main fix.
Testing Instructions
In Storybook:
Edit: it looks like the UI has changed and it's impossible to reproduce the bug in the editor as of now
In the editor:
Screenshots or screencast
Kapture.2024-09-30.at.14.18.39.mp4
Kapture.2024-09-30.at.14.22.18.mp4