chore(textInputGroup): add unique aria labels to examples - #7713
Conversation
|
@thatblindgeye For now I have added aria-labels to Based on the response I'll update the remaining examples. |
|
Preview: https://pf-pr-7713.surge.sh A11y report: https://pf-pr-7713-a11y.surge.sh |
thatblindgeye
left a comment
There was a problem hiding this comment.
One file comment below, and just the following:
- For the "Search input group, advanced search expanded" and "Search input group, advanced search expanded with autocomplete" examples, can we just tweak the "Submit" and "Reset" buttons in the examples so those have unique accessible names? We can keep it simple and apply unique ID's to the buttons themselves, then give each button an aria-labelledby that points to itself and the example heading (in that order). The end result should be an accessible name of "Submit Search input group, advanced search expanded" and so on.
| {{#> badge badge--modifier="pf-m-read"}} | ||
| <span aria-hidden="true">{{text-input-group--search-input--count}}</span> | ||
| {{#> screen-reader}} | ||
| {{#if text-input-group--search-input--IsNavigable}} |
There was a problem hiding this comment.
Looks like the "Search input group, match with navigable options" doesnt have this passed into it
mcoker
left a comment
There was a problem hiding this comment.
Looks great to me! Just a few small tweaks if you don't mind.
| {{#if text-input-group--search-input--aria-label}} | ||
| {{> text-input-group-text-input text-input-group-text-input--aria-label=text-input-group--search-input--aria-label }} | ||
| {{else}} | ||
| {{> text-input-group-text-input text-input-group-text-input--aria-label="Search input" }} | ||
| {{/if}} |
There was a problem hiding this comment.
FWIW we do have a ternary helper for handlebars that would make this less code
patternfly/scripts/helpers.mjs
Lines 67 to 75 in 9005060
| {{#if text-input-group--search-input--aria-label}} | |
| {{> text-input-group-text-input text-input-group-text-input--aria-label=text-input-group--search-input--aria-label }} | |
| {{else}} | |
| {{> text-input-group-text-input text-input-group-text-input--aria-label="Search input" }} | |
| {{/if}} | |
| {{> text-input-group-text-input text-input-group-text-input--aria-label=(ternary text-input-group--search-input--aria-label text-input-group--search-input--aria-label 'Search input' }} |
| {{#if text-input-group--search-input--clear-button-aria-label}} | ||
| {{> button | ||
| button--IsPlain=true | ||
| button--IsIcon=true | ||
| button--icon="times fa-fw" | ||
| button--aria-label=text-input-group--search-input--clear-button-aria-label | ||
| }} | ||
| {{else}} | ||
| {{> button | ||
| button--IsPlain=true | ||
| button--IsIcon=true | ||
| button--icon="times fa-fw" | ||
| button--aria-label="Clear input" | ||
| }} | ||
| {{/if}} |
There was a problem hiding this comment.
I'd use a ternary here, too
| {{#if text-input-group--search-input--clear-button-aria-label}} | |
| {{> button | |
| button--IsPlain=true | |
| button--IsIcon=true | |
| button--icon="times fa-fw" | |
| button--aria-label=text-input-group--search-input--clear-button-aria-label | |
| }} | |
| {{else}} | |
| {{> button | |
| button--IsPlain=true | |
| button--IsIcon=true | |
| button--icon="times fa-fw" | |
| button--aria-label="Clear input" | |
| }} | |
| {{/if}} | |
| {{> button | |
| button--IsPlain=true | |
| button--IsIcon=true | |
| button--icon="times fa-fw" | |
| button--aria-label=(ternary text-input-group--search-input--clear-button-aria-label text-input-group--search-input--clear-button-aria-label "Clear input") | |
| }} |
| ### Search input group, match with navigable options | ||
| ```hbs | ||
| {{> text-input-group--search-input text-input-group--id="text-input-group-search-input-group-match-with-navigable-options" text-input-group-text-input--placeholder="Find by name" text-input-group--value="John Doe" text-input-group--search-input--count="1 / 3" text-input-group--search-input--IsFirstMatch="true"}} | ||
| {{> text-input-group--search-input text-input-group--id="text-input-group-search-input-group-match-with-navigable-options" text-input-group-text-input--placeholder="Find by name" text-input-group--value="John Doe" text-input-group--search-input--count="1 / 3" text-input-group--search-input--IsFirstMatch="true" text-input-group--search-input--IsNavigable="true" text-input-group--search-input--aria-label="Search input group match with navigable options" text-input-group--search-input--clear-button-aria-label="Clear search input group match with navigable options"}} |
There was a problem hiding this comment.
The tiniest nittiest nit, just use true instead of "true" for setting something to true, unless you need to use the string "true" for some reason. In this case it should just be true. Our code is a little inconsistent that way, but we're trying to write all new code omitting the quotes unless you're passing a string to the parameter/attribute.
| {{> text-input-group--search-input text-input-group--id="text-input-group-search-input-group-match-with-navigable-options" text-input-group-text-input--placeholder="Find by name" text-input-group--value="John Doe" text-input-group--search-input--count="1 / 3" text-input-group--search-input--IsFirstMatch="true" text-input-group--search-input--IsNavigable="true" text-input-group--search-input--aria-label="Search input group match with navigable options" text-input-group--search-input--clear-button-aria-label="Clear search input group match with navigable options"}} | |
| {{> text-input-group--search-input text-input-group--id="text-input-group-search-input-group-match-with-navigable-options" text-input-group-text-input--placeholder="Find by name" text-input-group--value="John Doe" text-input-group--search-input--count="1 / 3" text-input-group--search-input--IsFirstMatch="true" text-input-group--search-input--IsNavigable=true text-input-group--search-input--aria-label="Search input group match with navigable options" text-input-group--search-input--clear-button-aria-label="Clear search input group match with navigable options"}} |
|
🎉 This PR is included in version 6.3.0-prerelease.51 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes: #7289