Skip to content

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Aug 7, 2025

Closes: https://github.com/github/primer/issues/4723

Changelog

  • Ensure that the tooltip is keyboard-accessible even when the control is disabled. This is important since all SegmentedControl.IconButton will show a tooltip by default, and we want this to be accessible for keyboard users even when the control is disabled.
  • Reverts revert PR (Revert "Clean up the feature flag for primer_react_segmented_control_tooltip" #6412)
    • When we first tried to ship our cleanup of primer_react_segmented_control_tooltip, 1 integration test failed in dotcom. This is because a tooltip was now being applied on a disabled control, causing the <Tooltip> component to thrown an area. This will be resolved by the aforementioned change.

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

Merge checklist

Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 154deb0

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 Minor
@primer/styled-react Major

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 Aug 7, 2025
Copy link
Contributor

github-actions bot commented Aug 7, 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 Aug 7, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 89.52 KB (+0.12% 🔺)
packages/react/dist/browser.umd.js 89.64 KB (+0.02% 🔺)

…t_segmented_control_tooltip`"

This reverts commit 602b29a.
@github-actions github-actions bot temporarily deployed to storybook-preview-6516 August 29, 2025 18:37 Inactive
@khiga8 khiga8 changed the title [a11y] When aria-disabled is set on SegmentedControl, the selected tab should not change [a11y] When aria-disabled is set on SegmentedControl, don't allow action Aug 29, 2025
@khiga8 khiga8 marked this pull request as ready for review August 29, 2025 19:54
@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 19:54
@khiga8 khiga8 requested a review from a team as a code owner August 29, 2025 19:54
@khiga8 khiga8 requested a review from pksjce August 29, 2025 19:54
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 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 apply aria-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}
Copy link

Copilot AI Aug 29, 2025

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}
Copy link

Copilot AI Aug 29, 2025

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}
Copy link

Copilot AI Aug 29, 2025

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.

<SegmentedControl.Button aria-label={'Raw'} leadingIcon={FileCodeIcon}>
Raw
</SegmentedControl.Button>
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled={true}>
Copy link

Copilot AI Aug 29, 2025

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.

Suggested change
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled={true}>
<SegmentedControl.Button aria-label={'Blame'} leadingIcon={PeopleIcon} disabled>

Copilot uses AI. Check for mistakes.

khiga8 and others added 2 commits August 29, 2025 16:01
…stories.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot temporarily deployed to storybook-preview-6516 August 29, 2025 20:05 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6516 September 12, 2025 18:31 Inactive
@TylerJDev TylerJDev added this pull request to the merge queue Oct 10, 2025
@TylerJDev TylerJDev mentioned this pull request Oct 10, 2025
Merged via the queue into main with commit f896b37 Oct 10, 2025
42 of 46 checks passed
@TylerJDev TylerJDev deleted the kh-segmented-control branch October 10, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: failing Changes in this PR cause breaking changes in gh/gh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants