Skip to content

Conversation

pksjce
Copy link
Contributor

@pksjce pksjce commented Sep 1, 2025

Part of https://github.com/github/primer/issues/5628

During a migration effort on github-ui, I found that a test there was failing due to Banner setting both aria-labelled-by and aria-label

Changelog

New

Changed

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

Merge checklist

@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 07:45
@pksjce pksjce requested a review from a team as a code owner September 1, 2025 07:45
@pksjce pksjce requested a review from francinelucca September 1, 2025 07:45
Copy link

changeset-bot bot commented Sep 1, 2025

🦋 Changeset detected

Latest commit: eeba853

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

This PR includes changesets to release 2 packages
Name Type
@primer/react Patch
@primer/styled-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

Copy link
Contributor

@Copilot 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 in the Banner component by implementing proper precedence for aria labeling attributes. When both aria-labelledby and aria-label are provided, the component now prioritizes aria-labelledby and conditionally sets aria-label only when aria-labelledby is not present.

  • Adds support for aria-labelledby prop extraction and conditional aria attribute setting
  • Implements proper accessibility precedence where aria-labelledby takes priority over aria-label
  • Adds comprehensive test coverage for the new labeling behavior

Reviewed Changes

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

File Description
packages/react/src/Banner/Banner.tsx Extracts aria-labelledby prop and implements conditional logic to prevent both aria attributes from being set simultaneously
packages/react/src/Banner/Banner.test.tsx Adds test cases to verify proper aria attribute precedence and that only one labeling method is used at a time

@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 Sep 1, 2025
Copy link
Contributor

github-actions bot commented Sep 1, 2025

👋 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!

Copy link
Contributor

github-actions bot commented Sep 1, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 89.83 KB (0%)
packages/react/dist/browser.umd.js 90 KB (0%)

@github-actions github-actions bot requested a deployment to storybook-preview-6701 September 1, 2025 07:53 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6701 September 1, 2025 08:02 Inactive
@pksjce
Copy link
Contributor Author

pksjce commented Sep 2, 2025

The failure in the integration tests is unrelated to this PR and I'm investigating it separately.

@primer-integration
Copy link

😢 Hi from github/github-ui. The integration workflow has failed: https://github.com/github/github-ui/actions/runs/17419544075

@pksjce pksjce added this pull request to the merge queue Sep 4, 2025
Merged via the queue into main with commit 1aa7404 Sep 4, 2025
43 checks passed
@pksjce pksjce deleted the pk/banner-aria-fix branch September 4, 2025 03:53
@primer primer bot mentioned this pull request Sep 4, 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.

2 participants