Skip to content

docs(Button): document built-in loading announcement#8123

Draft
adierkens wants to merge 2 commits into
mainfrom
adierkens-button-loading-docs
Draft

docs(Button): document built-in loading announcement#8123
adierkens wants to merge 2 commits into
mainfrom
adierkens-button-loading-docs

Conversation

@adierkens

@adierkens adierkens commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes #7881

Documents the Button (and IconButton) built-in loading announcement behavior. When the loading prop is set, the component already renders a visually hidden, polite live-region announcement (default "Loading"), customizable via the loadingAnnouncement prop. The previous docs omitted this and instead told consumers to build their own aria-live loading message, which causes a duplicate announcement.

This is a docs-only change (prop doc metadata, JSDoc comments, and Storybook story descriptions). No component source or runtime behavior is affected.

Note

This supersedes the earlier closed attempt in #7882. That PR's review feedback was that it updated the prop documentation but "completely missed the React examples section in the main component docs." This PR addresses that by adding narrative to the loading example stories via the standard parameters.docs.description.story pattern (rather than rendering prose inside the story components), and by surfacing the existing LoadingStatusAnnouncement* result-announcement examples in the docs.

Changelog

New

  • Added the missing loading and loadingAnnouncement prop entries to IconButton.docs.json.
  • Surfaced the existing LoadingStatusAnnouncementSuccessful / LoadingStatusAnnouncementError examples in Button.docs.json, with descriptions explaining how announcing the result complements the built-in loading announcement.

Changed

  • Expanded the loading / loadingAnnouncement JSDoc in Button/types.ts and their descriptions in Button.docs.json to explain the built-in announcement and warn against adding a separate aria-live message.
  • Added narrative story descriptions for the Button/IconButton loading stories.

Removed

  • N/A

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

Docs-only change — no changes to the published component source or runtime behavior, so no release is required. The skip changeset label is applied.

Testing & Reviewing

Review the updated prop descriptions in Button.docs.json / IconButton.docs.json, the JSDoc in types.ts, and the story descriptions in Button.features.stories.tsx, IconButton.features.stories.tsx, and Button.examples.stories.tsx. Confirmed against ButtonBase.tsx: loadingAnnouncement defaults to 'Loading' and renders a VisuallyHidden AriaStatus (polite) live region when loading is set.

Note

The narrative accessibility guidance on primer.style/product (which previously recommended a manual aria-live message) lives in the separate github/primer-docs repo and is updated in a companion PR.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github-ui

Document that Button and IconButton automatically render a visually
hidden polite live-region announcement (default "Loading") when the
`loading` prop is set, that the text is customizable via
`loadingAnnouncement`, and that consumers should not add their own
aria-live loading message to avoid duplicate announcements.

Closes #7881

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e505760

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@adierkens adierkens added the skip changeset This change does not need a changelog label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@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 Jul 6, 2026
Address review feedback from the earlier attempt (#7882): the React
examples section, not just the props table, should reflect the loading
behavior. Reference the existing LoadingStatusAnnouncementSuccessful and
LoadingStatusAnnouncementError example stories from Button.docs.json and
add narrative describing how they complement the built-in loading
announcement (the button announces "Loading"; consumers announce the
result).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document button loading announcements in component docs

1 participant