-
Notifications
You must be signed in to change notification settings - Fork 149
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
Move aria-labelledby
into computed menu props
#729
Conversation
✅ Deploy Preview for accessible-autocomplete ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
94f3c72
to
245bd23
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.
Neat, it does clean up all these examples with the menuAttributes
🙌🏻 It's bringing a tiny breaking change in its current state, though. Will other PRs bring breaking changes for the accessible-autocomplete? If not, I've proposed a fix to set the default aria-labelledby
non breaking.
245bd23
to
e14f225
Compare
e14f225
to
4a7f765
Compare
4a7f765
to
a620213
Compare
@@ -508,6 +508,8 @@ export default class Autocomplete extends Component { | |||
} | |||
|
|||
const computedMenuAttributes = { | |||
// set aria-labelledby first so that users can override it with menuAttributes |
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.
Good shout adding a comment 😍
a620213
to
389e8e8
Compare
From the description it wasn't clear to me what this PR did, specifically how it fixed the issue raised. It might have been better to give it the same name independent of the search term, like "results list". |
What/Why
The examples include
aria-labelledby
's passed to the autocomplete viamenuAttributes
. This change movesaria-labelledby
into the computed menu attributes so that it's provided by default.This was prompted by a recent DAC audit of the GOV.UK Design System website which noted that the
aria-labelledby
is absent from our site search. We could solve this fairly quickly by just addingmenuAttributes
to the site search autocomplete, but solving it upstream is the more holistic option. This also means all users of the autocomplete don't need to add their ownaria-labelledby
.Resolves alphagov/govuk-design-system#4005
Notes
We could also use
aria-label
instead ofaria-labelledby
, however I'm not sure whataria-label
could be. We could potentially explore a dynamicaria-label
but this could be challenging when trying to take internationalisation into account. In my opinion,aria-labelledby
is the more managable option.