-
Notifications
You must be signed in to change notification settings - Fork 639
fix(AnchoredOverlay): Omit aria-label and aria-labelledby from renderAnchor props #6973
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
Conversation
🦋 Changeset detectedLatest commit: 4ab0cf2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There was a problem hiding this 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 a TypeScript type conflict in the AnchoredOverlay component where the renderAnchor prop would pass accessibility properties that could conflict with IconButton's strict accessibility requirements. The IconButton component requires either aria-label
OR aria-labelledby
but not both, and the previous implementation could cause type errors when both were present.
Key Changes
- Modified the
renderAnchor
prop type to excludearia-label
andaria-labelledby
from the props passed to the anchor element - Added a type test to verify the fix works correctly with IconButton components
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
AnchoredOverlay.tsx | Updated renderAnchor prop type to omit aria-label and aria-labelledby from passed props |
AnchoredOverlay.types.test.tsx | Added type test to verify IconButton with aria-label works without TypeScript errors |
👋 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! |
Do you think the requirement is more like having either one of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
From what I could tell we weren't using these labels in the renderAnchor props, they were inherited by declaring all html attributes as the type. It is the IconButton's requirements that we use one or the other. And these are controlled by the user so I think omitting the type from the spread is valid fix here. |
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/4617 |
🟢 ci completed with status |
Closes https://github.com/github/primer/issues/5180
The error was caused by a type conflict with the IconButton component's accessibility props. The IconButton component has a strict type constraint requiring either aria-label OR aria-labelledby (but not both). When the AnchoredOverlay's renderAnchor function passes props that might include aria-labelledby, and we also explicitly provide aria-label="Info", TypeScript detected a potential violation of this constraint.
Changelog
New
Changed
AnchoredOverlay, omit aria-label and aria-labelledby from renderAnchor props
Removed
Rollout strategy
Testing & Reviewing
Merge checklist