-
Notifications
You must be signed in to change notification settings - Fork 638
[a11y] When aria-disabled is set on SegmentedControl, don't allow action #6516
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: 154deb0 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 |
👋 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! |
size-limit report 📦
|
d5c3571
to
27b3a27
Compare
…t_segmented_control_tooltip`" This reverts commit 602b29a.
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 implements accessibility improvements for SegmentedControl components by preventing actions when aria-disabled
is set and removes the feature flag for segmented control tooltips to make them the default behavior.
Key changes:
- Adds
disabled
prop support to SegmentedControl buttons to applyaria-disabled
attribute - Implements click prevention logic when components are aria-disabled
- Removes the
primer_react_segmented_control_tooltip
feature flag and makes tooltips the default
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
packages/react/src/SegmentedControl/SegmentedControlIconButton.tsx | Removes feature flag logic and simplifies component to always render with tooltip |
packages/react/src/SegmentedControl/SegmentedControlButton.tsx | Adds disabled prop and applies aria-disabled attribute |
packages/react/src/SegmentedControl/SegmentedControl.tsx | Implements click prevention logic for aria-disabled buttons |
packages/react/src/SegmentedControl/SegmentedControl.test.tsx | Updates tests to remove feature flag dependencies |
packages/react/src/SegmentedControl/SegmentedControl.examples.stories.tsx | Adds new story demonstrating disabled button functionality |
packages/react/src/SegmentedControl/SegmentedControl.dev.stories.tsx | Adds development story for aria-disabled testing |
packages/react/src/FeatureFlags/DefaultFeatureFlags.ts | Removes the segmented control tooltip feature flag |
.changeset/strong-mangos-rest.md | Documents the feature flag removal as a minor release |
<SegmentedControl.IconButton | ||
onClick={handleOnClick} | ||
aria-label={'Preview'} | ||
aria-disabled={true} |
Copilot
AI
Aug 29, 2025
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.
Use boolean literal true
instead of {true}
for boolean props. This can be simplified to just aria-disabled
.
Copilot uses AI. Check for mistakes.
Preview | ||
</SegmentedControl.IconButton> | ||
<SegmentedControl.IconButton | ||
aria-disabled={true} |
Copilot
AI
Aug 29, 2025
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.
Use boolean literal true
instead of {true}
for boolean props. These can be simplified to just aria-disabled
.
Copilot uses AI. Check for mistakes.
Raw | ||
</SegmentedControl.IconButton> | ||
<SegmentedControl.IconButton | ||
aria-disabled={true} |
Copilot
AI
Aug 29, 2025
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.
Use boolean literal true
instead of {true}
for boolean props. These can be simplified to just aria-disabled
.
Copilot uses AI. Check for mistakes.
packages/react/src/SegmentedControl/SegmentedControl.examples.stories.tsx
Outdated
Show resolved
Hide resolved
<SegmentedControl.Button aria-label={'Raw'} leadingIcon={FileCodeIcon}> | ||
Raw | ||
</SegmentedControl.Button> | ||
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled={true}> |
Copilot
AI
Aug 29, 2025
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.
Use boolean literal true
instead of {true}
for boolean props. These can be simplified to just disabled
.
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled={true}> | |
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled> |
Copilot uses AI. Check for mistakes.
…stories.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Closes: https://github.com/github/primer/issues/4723
Changelog
SegmentedControl.IconButton
will show a tooltip by default, and we want this to be accessible for keyboard users even when the control is disabled.primer_react_segmented_control_tooltip
" #6412)primer_react_segmented_control_tooltip
, 1 integration test failed in dotcom. This is because a tooltip was now being applied on adisabled
control, causing the<Tooltip>
component to thrown an area. This will be resolved by the aforementioned change.Rollout strategy
Merge checklist