-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Use aria-pressed
attribute instead of the hard-coded is-pressed
class
#55004
Conversation
Size Change: -5 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Could we use |
Flaky tests detected in 9719b78. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6392470457
|
isPressed
prop instead of the hard-coded is-pressed
classaria-pressed
attribute instead of the hard-coded is-pressed
class
In terms of semantics, A few options come to mind:
I'd probably be up for applying both fixes, since one doesn't exclude the other. Finally, one last consideration: this is a typical example of why we discourage consumers of |
Thank you for your detailed opinion!
Regarding this PR, do you mean that In that case, when updating the |
In this case, This one's a bit harder. There aren't any clear additional semantics at play, because it's mostly a visual indication that the underlying menu has something selected. But again,
For what it's worth, this was the case, but it broke other things, so it had to be reverted. If we go ahead with this, we'll need to proceed with caution!
Would be relatively straightforward to add While we're talking semantics, the dropdown menu needs a bit of work. The toggle button should link to the menu with an |
Yes, we should be using the correct attribute for the context. That might also be |
Thank you @andrewhayward for the feedback! So I guess the immediate next step is to put back the As follow-ups, we could:
What do y'all think?
That's good feedback for my work on the next version of |
Yes, I also agree with this approach 👍 |
Cool! I guess we can close this PR and open a new one that adds the |
Fixes: #55002
Related to #54740
What?
This PR uses the
isPressed
proparia-pressed
attribute instead in components that have manually assigned theis-pressed
class.This PR fixes two unintended pressed styles:
Why?
In #54740,
isPressed
prop is now internally converted to thearia-pressed
attribute. However, as fixed in this PR,isPressed
prop oraria-pressed
attribute may not be used and theis-pressed
class is given directly.In this case, the component will not be given the
aria-pressed
attribute; the selector for the.is-pressed
class has been removed here, and the intended style will not be applied.How?
Simply replaced with
isPressed
proparia-pressed
attribute.Testing Instructions
Other concern
As in this case, there may be many consumers who directly grant the
is-pressed
class just to change its appearance. Reinstating the selector that was removed here would solve that, but would instead break the backward compatibility mentioned in #54740.I think we need to explore approaches to resolve these.