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

fix: a11y: search component submit accessible naming #2737

Merged
merged 19 commits into from
Feb 22, 2024

Conversation

shkeating
Copy link
Contributor

@shkeating shkeating commented Feb 1, 2024

Summary

adds support for accessible name for search submit button in small search variant, and enhances naming capabilities on all search variants submit button to prevent duplicate naming issues on pages with multiple search components. Example of this scenario in USSF portal provided in screen shots.

Related Issues or PRs

How To Test

check output in ANDI, which should reflect the fallback name of "Search". Note, the aria label added to the non-small variants will not conflict with the typed name button text in the default instances, because the aria label will override the button text in the accessibility tree. This will allow us to have "search" appear visually for users who will have visual context, but more precise labeling for users of assistive tech.

I encourage reviewers to be vigilant in the changes made to the Search test file. My intention is to pull this into the USSF portal repo to ensure it works as expected.

Screenshots (optional)

Example of multiple searches in a single interface

image

ANDI outputs in local storybook for react-uswds

Buttons with inner text
image
Small Search: Buttons without Inner Text
image

…viding an accessible name to small search submit, and a unique accessible name to the other variants. Sets default value to string of search, based on USWDS docs.
…e button naming issue on pages that may have multiple searches
@shkeating shkeating added the a11y Relates to accessibility standards and practices label Feb 1, 2024
@shkeating shkeating self-assigned this Feb 1, 2024
Copy link
Contributor

github-actions bot commented Feb 1, 2024

Warnings
⚠️ This PR does not include changes to storybook, even though it affects component code.

Generated by 🚫 dangerJS against 7d953ce

@shkeating shkeating changed the title fix: a11y: adds support for accessible name for search submit button in small search variant, and enhances naming capab fix: a11y: search component submit accessible naming Feb 1, 2024
@shkeating shkeating marked this pull request as ready for review February 1, 2024 02:45
@shkeating shkeating requested a review from a team as a code owner February 1, 2024 02:45
@AnnaGingle
Copy link

Taking a look now!

AnnaGingle
AnnaGingle previously approved these changes Feb 1, 2024
Copy link

@AnnaGingle AnnaGingle left a comment

Choose a reason for hiding this comment

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

The ANDI output works as expected. No visual changes in the design. Great work!

brandonlenz
brandonlenz previously approved these changes Feb 2, 2024
Copy link
Contributor

@brandonlenz brandonlenz left a comment

Choose a reason for hiding this comment

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

Non blocking, but minor code organizational nit recommended in review comments

src/components/Search/SearchButton/SearchButton.tsx Outdated Show resolved Hide resolved
src/components/Search/SearchButton/SearchButton.tsx Outdated Show resolved Hide resolved
@shkeating shkeating dismissed stale reviews from AnnaGingle and brandonlenz via 4bb23da February 8, 2024 00:29
@shkeating shkeating force-pushed the 2736-shk-small-button-search-name branch from c147d9d to 2d89748 Compare February 8, 2024 00:57
@shkeating shkeating requested a review from brandonlenz February 8, 2024 02:29
@werdnanoslen
Copy link
Contributor

@shkeating is the tooltip supposed to be always visible, as Happo's showing?

@shkeating
Copy link
Contributor Author

@shkeating is the tooltip supposed to be always visible, as Happo's showing?

i don't know why that is happening. Is that happening on other branches? I didn't touch the tooltip code. And it looks like it is isolated to Safari? 🤔

@shkeating
Copy link
Contributor Author

status update: not behaving as expected. aria-label attribute getting added with incorrect name to form element insead of the search button.

image

@shkeating shkeating force-pushed the 2736-shk-small-button-search-name branch from de0959f to 740b873 Compare February 14, 2024 16:34
Copy link
Contributor

@gidjin gidjin left a comment

Choose a reason for hiding this comment

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

I used yarn link as described in our docs here to import this branch into our project and the aria-label shows up for search buttons as expected when I run it all locally.

SCR-20240221-s0n

SCR-20240221-s1b

@shkeating shkeating merged commit b5fb85d into main Feb 22, 2024
8 checks passed
@shkeating shkeating deleted the 2736-shk-small-button-search-name branch February 22, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Relates to accessibility standards and practices
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants