Skip to content

Conversation

@owenniblock
Copy link
Contributor

Closes https://github.com/github/copilot-issues-xp/issues/309

Changelog

New

Changed

Only include the id for the loading state element when the component is in the loading state.

Removed

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

Testing with storybook

Merge checklist

Copilot AI review requested due to automatic review settings December 16, 2025 10:34
@owenniblock owenniblock requested a review from a team as a code owner December 16, 2025 10:34
@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2025

🦋 Changeset detected

Latest commit: ed5f23e

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 Patch

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

@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 Dec 16, 2025
@github-actions
Copy link
Contributor

👋 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. Or, apply the integration-tests: skipped manually label to skip these checks.

@owenniblock owenniblock added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Dec 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an accessibility issue where the Button component was always including a loading announcement ID in its aria-describedby attribute, even when the button was not in a loading state. The fix ensures that the loading announcement ID is only included when the button is actually loading, matching when the AriaStatus element is rendered in the DOM.

Key changes:

  • Conditional construction of aria-describedby IDs based on loading state
  • Simplified inline filtering logic by pre-filtering IDs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/react/src/Button/ButtonBase.tsx Implements conditional logic to only include loading announcement ID in aria-describedby when loading is true
.changeset/ripe-baths-rush.md Adds changeset documenting this patch-level fix for aria-describedby behavior

@github-actions github-actions bot temporarily deployed to storybook-preview-7347 December 16, 2025 10:45 Inactive
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Dec 16, 2025
)
const buttonNode = container.getByRole('button')

fireEvent.click(buttonNode)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test component shows the loading element after the button has been clicked.

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Sounds sensible!

I'd recommend running the integration tests just to make sure there isn't a test in dotcom that expects aria-describedby to always exist

@owenniblock
Copy link
Contributor Author

@siddharthkp looks like there's an issue with this test: https://github.com/github/github-ui/blob/main/packages/mergebox/components/sections/__tests__/ConflictsSection.test.tsx#L600 - although looking at the logic, I can't see why it's failing 🤔

@siddharthkp
Copy link
Member

although looking at the logic, I can't see why it's failing 🤔

Same, reading the test, it shouldn't fail because of this PR. I'd recommend running it once in codespaces as well for the branch and for main, just to be sure it's related.

@owenniblock
Copy link
Contributor Author

OK - it's related. It looks like the waitFor behaves differently when the id is set by the element referenced by the id isn't in the DOM 🤯 basically it seems to wait for a bit to see if the DOM element appears.

Whereas the check when there is no aria-describedby instantly fails and goes around the loop for another try 😅

The fix is to change the assertion so it's not doing a count (which seems pretty likely to be flaky anyway).

I see that this has already been done in another test in the same file

Testing with a change on the validation PR.

How would we normally handle changes like this? I could cherrypick the fix into github before we merge my original primer react PR since it'll still pass for the old version of Primer?

@owenniblock
Copy link
Contributor Author

@siddharthkp there were some legitimate test failures as well which I've added fixes for on that PR. Assuming the PR is green I'll create a clean dotcom PR so we can get this PR moving 😄

@siddharthkp
Copy link
Member

How would we normally handle changes like this? I could cherrypick the fix into github before we merge my original primer react PR since it'll still pass for the old version of Primer?

We don't have any rules around that (yet?). I prefer to do exactly what you said, prepare github for the change and then make the primer change.

@owenniblock
Copy link
Contributor Author

@siddharthkp integration test results are all green 🎉 Think this is ready to go 😄

@siddharthkp
Copy link
Member

siddharthkp commented Dec 18, 2025

@siddharthkp integration test results are all green 🎉 Think this is ready to go 😄

Amazing! I see is also merged https://github.com/github/github-ui/pull/9052. I've already approved the PR, so you can merge whenever you'd like

--

github-ui checks are still waiting

I see the required checks are still waiting and won't let you merge. That's because the integration PR in github-ui does not have the latest commit from this primer/react PR, which is a bit annoying. I'll run it again so that it can pull in the latest commit and let you through

@primer-integration
Copy link

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

@primer-integration
Copy link

🔬 github-ui Integration Test Results

Check Status Details
CI ✅ Passed View run
Projects (Memex) ✅ Passed View run
VRT ✅ Passed View run

All checks passed! Your integration PR is ready for review.

@siddharthkp
Copy link
Member

'll run it again so that it can pull in the latest commit and let you through

Done! Merge away!

@owenniblock owenniblock added this pull request to the merge queue Dec 18, 2025
@owenniblock
Copy link
Contributor Author

Yay, thanks @siddharthkp - merging 🎉

Merged via the queue into main with commit 72c7a7f Dec 18, 2025
52 checks passed
@owenniblock owenniblock deleted the remove-aria-described-by-when-not-loading branch December 18, 2025 17:17
@primer primer bot mentioned this pull request Dec 18, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants