alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.17k stars 320 forks source link

Inconsistent Nunjucks parameter names for aria-label #5277

Open matteason opened 1 month ago

matteason commented 1 month ago

There are several components which allow you to pass the text for the aria-label on the component's wrapper element. The names of these parameters are inconsistent despite them doing the same thing.

Cookie banner and service navigation use ariaLabel.

Pagination uses landmarkLabel and breadcrumbs uses labelText.

Pagination also includes a visuallyHiddenText param for pagination items. On most components, visuallyHiddenText params are appended to the visible text (for example in summary card actions); pagination is the only example I can find where visuallyHiddenText is passed directly to aria-label, completely overriding any visual label

The documentation for the params is also structured differently. For example the docs for pagination and breadcrumbs don't mention that the value will be used as the aria-label, while they do for cookie banner and service navigation.

Are any of these differences intentional? I think ariaLabel is clearest about what the params actually do, with [thing]AriaLabel for labels of child elements (eg password uses showPasswordAriaLabelText, though again the Text makes that inconsistent)