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

TextInput: Add LeadingVisual/TrailingVisual to be part of the accessible description in TextInput #4939

Merged
merged 20 commits into from
Oct 17, 2024

Conversation

TylerJDev
Copy link
Contributor

@TylerJDev TylerJDev commented Sep 9, 2024

Closes https://github.com/github/primer/issues/3438 https://github.com/github/primer/issues/3465

Changelog

New

  • Adds aria-describedby for LeadingVisual and TrailingVisual
  • Adds new prop loaderText to convey loading state to screen readers

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

(https://github.com/github/github/pull/341243, integration tests pass with minor changes, and some unrelated failures)

Copy link

changeset-bot bot commented Sep 9, 2024

🦋 Changeset detected

Latest commit: e9d65a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 9, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 97.15 KB (+0.15% 🔺)
packages/react/dist/browser.umd.js 97.43 KB (+0.04% 🔺)

@TylerJDev TylerJDev changed the title TextInput: Add LeadingVisual text to be accessible description of TextInput TextInput: Add LeadingVisual/TrailingVisual to be part of the accessible description in TextInput Sep 9, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-4939 September 9, 2024 20:32 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4939 September 9, 2024 21:13 Inactive
@TylerJDev TylerJDev marked this pull request as ready for review September 10, 2024 13:55
@TylerJDev TylerJDev requested a review from a team as a code owner September 10, 2024 13:55
Comment on lines +28 to +29
/** Text for screen readers to convey the loading state */
loaderText?: string
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 I wonder if it's really necessary / a good idea for consumers to be able to customize this? It inherently means they'll be providing a different experience for sighted vs non-sighted users, because sighted users won't be able to access this text. Visually a loading indicator only indicates that something is loading, so "Loading" should be sufficient always.

Alternatively, we could make this visible by putting it in a tooltip. But that doesn't seem ideal since the loader is not focusable.

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 question, and good point! This mainly stems from https://github.com/github/primer/issues/3465. I believe the idea is, if there's context outside of the input that conveys what is loading then it might be a good idea to add more descriptive text to indicate what is loading so users don't have to navigate outside of it to get that context.

I think this is a more specific use case that won't be used unless necessary, so in most cases having the default "Loading" is okay, which we could make more descriptive 🤔

Cc: @patrickhlauke - curious if you have any additional thoughts here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the idea is, if there's context outside of the input that conveys what is loading then it might be a good idea to add more descriptive text to indicate what is loading so users don't have to navigate outside of it to get that context.

If we do keep this prop, I think this (particularly the par about the context outside the input) seems like it would be useful to add to the props documentation. I think what may happen is consumers will see that this prop exists and think that they should fill it out similarly to how they fill out alt text in an image - they'll have good intentions but actually create a less accessible experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, that's totally fair @iansan5653! I can add a note on this in the props docs to make sure consumers aren't haphazardly using it!

Co-authored-by: Ian Sanders <iansan5653@github.com>
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 14, 2024
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/347575

@primer-integration
Copy link

primer-integration bot commented Oct 17, 2024

🟢 golden-jobs completed with status success.

@TylerJDev TylerJDev added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 17, 2024
@TylerJDev TylerJDev added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit 9936add Oct 17, 2024
47 checks passed
@TylerJDev TylerJDev deleted the tylerjdev/add-aria-describedby-textinput branch October 17, 2024 21:51
@primer primer bot mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh status: review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants