Skip to content

Conversation

@gcamacho079
Copy link
Contributor

@gcamacho079 gcamacho079 commented Jan 12, 2026

Description

  • Waits for child components in the craft-button component to load, then calculates the accessible name. If no accessible name is found, it updates the button with an error icon.
  • Updates some of the labels we've had pre-v6 for clarity — toggle versus show, since "Show" insinuates that the toggle is aria-expanded="false", even though the state may have changed to aria-expanded="true"

Related issues

Resolves PT-3005, PT-3000, PT-3004

@linear
Copy link

linear bot commented Jan 12, 2026

…anded state is updated; in navigation, reference text slot in accessible name for toggle button
@gcamacho079 gcamacho079 added the accessibility 👤 features related to accessibility label Jan 13, 2026
@gcamacho079 gcamacho079 marked this pull request as ready for review January 13, 2026 18:10
@brianjhanson
Copy link
Contributor

I updated the styles a bit to hopefully make these issues stand out a bit more

CleanShot 2026-01-20 at 08 40 34

Other than that, looks good! I'm curious if we'll end up seeing a performance hit from calculating the computed name whenever the button renders, but I feel like we can just keep an eye on it.

If we do, I'm curious if we could just include something like a11y.css and have a way to toggle it easily to achieve a similar goal without the same overhead.

@gcamacho079
Copy link
Contributor Author

gcamacho079 commented Jan 20, 2026

I updated the styles a bit to hopefully make these issues stand out a bit more
CleanShot 2026-01-20 at 08 40 34

That looks great, @brianjhanson! I updated the styles to use some of the new color tokens that meet contrast. I initially had visually-hidden text inside the button that read Error, but the recent update changed it to !. I'm now considering the following update:

We mark the CSS content as decorative (content: '!'/'') so that the button still doesn't receive an accessible name; however, we can include visually-hidden error text outside the button that we can reference via aria-describedby.

<span aria-hidden="true" id="global-accName-error"></span> // Hidden visually and — due to `aria-hidden` — only encountered via SR users when it's referenced via `aria-describedby`
<button aria-describedby="global-accName-error"></button> // Button without an accName

This would have the following benefits:

  • The issue could also show up via an automated a11y scan inside the control panel, so it isn't only obvious via a visual change
  • The error messaging has a text alternative via the aria-describedby attribute on the button

Thoughts? 🤔

Other than that, looks good! I'm curious if we'll end up seeing a performance hit from calculating the computed name whenever the button renders, but I feel like we can just keep an eye on it.

If we do, I'm curious if we could just include something like a11y.css and have a way to toggle it easily to achieve a similar goal without the same overhead.

My understanding of a CSS solution like this is that we could technically check to see if the attributes exist, but not necessarily if there is a calculated accessible name. For example, we could only show the error styles if aria-label or aria-labelledby are not present on the button; but what if the aria-labelledby attribute is present, but it points to an empty HTML element? That would result in there not being an accessible name.

You previously mentioned that we could implement a11y checks like this only when we're in devMode. If the infrastructure is in-place for that, that might be the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility 👤 features related to accessibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants