Skip to content
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

UI: a11y sidebranch - labels #24480

Merged
merged 10 commits into from
Dec 12, 2023

Conversation

hashishaw
Copy link
Contributor

@hashishaw hashishaw commented Dec 11, 2023

This PR adds labels to tags that require them (<nav>, <input>, etc). The changes in this PR are based on failures from the Integration tests only.

Unfortunately, a couple 3rd party components that we use (CodeMirror and ember power select to be specific) have violations that are causing widespread failures. But, I tried to address all the instances that we can control.

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Dec 11, 2023
<Hds::Button
class="hds-side-nav__icon-button"
{{on "click" (action "fullscreen")}}
title={{if this.isFullscreen "minimize" "maximize"}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltip trigger didn't have valid label associated, so I removed it. With a title on the icon button sighted users can still see the text

Copy link

Build Results:
All builds succeeded! ✅

@hashishaw hashishaw force-pushed the ui/a11y-testing/labels branch from 115dde8 to 1d4e25b Compare December 11, 2023 20:59
>{{this.key.value}}</textarea>
</div>
<p class="help has-text-grey">
<p class="help has-text-grey" id={{concat "pgpFileTextarea-" this.elementId}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p class="help has-text-grey" id={{concat "pgpFileTextarea-" this.elementId}}>
<p class="help has-text-grey" id="pgpFileTextarea-{{this.elementId}}">

Comment on lines 40 to +41
data-test-pgp-file-textarea={{true}}
aria-labelledby={{concat "pgpFileTextarea-" this.elementId}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary to update, just suggesting

Suggested change
data-test-pgp-file-textarea={{true}}
aria-labelledby={{concat "pgpFileTextarea-" this.elementId}}
data-test-pgp-file-textarea
aria-labelledby="pgpFileTextarea-{{this.elementId}}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - I see you just copy/pasted from above! Disregard!

Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of small changes. Thanks for your efforts on this!

@@ -38,9 +38,10 @@
class="textarea"
oninput={{action "updateData"}}
data-test-pgp-file-textarea={{true}}
aria-labelledby={{concat "pgpFileTextarea-" this.elementId}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointing it out for the future but we'll need a different solution for a unique id when this component is refactored to glimmer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good note! I've used guidFor in other places when I need the element ID on glimmer components: https://ember-learn.github.io/ember-octane-vs-classic-cheat-sheet/#component-templates__element-id

@@ -6,7 +6,7 @@
{{#unless @uploadOnly}}
<div class="level is-mobile">
<div class="level-left">
<label for="input-{{this.elementId}}" class="has-text-weight-semibold" data-test-text-file-label>
<label id="text-file-input-label" class="has-text-weight-semibold" data-test-text-file-label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will eventually need a way to easily add a unique value to things like id's since the component could be used multiple times on the same page. Maybe a helper that uses guidFor or something along those lines.

Copy link

@didoo didoo Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://rfcs.emberjs.com/id/0659-unique-id-helper/

if it can be of help, this is a nice syntax/helper to add IDs directly in the template, we've used in a few places in HDS (to be checked if the Ember version you're using in Vault supports it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I do want the ID's to be unique. Now that the other tests are somewhat stable I'll put the elementID back and check whether it's still failing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: it was originally failing in one test, when uploadOnly is passed which does not render the label. In other places I tried to make the input ID's deterministic so that if we do have a label outside of the input, we can add for="the-id" to the label and it connects it, but when we use random ID's that's not possible. I think this is something to think about for our form refresh, but for now I just added a screenreader-only label when uploadOnly is true.

Copy link
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks for getting us up to date! 🚀

@hashishaw hashishaw merged commit 0856125 into ui/VAULT-22618/add-a11y-testing Dec 12, 2023
37 of 38 checks passed
@hashishaw hashishaw deleted the ui/a11y-testing/labels branch December 12, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants