Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-phones-notice.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

SegmentedControl: Resolve axe-violation by adding a discernible text to the icon button and removing the tooltip until it is marked as accessible
23 changes: 11 additions & 12 deletions src/SegmentedControl/SegmentedControlIconButton.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,6 @@ import {IconProps} from '@primer/octicons-react'
import styled from 'styled-components'
import sx, {merge, SxProp} from '../sx'
import {getSegmentedControlButtonStyles, getSegmentedControlListItemStyles} from './getSegmentedControlStyles'
import Tooltip from '../Tooltip'
import Box from '../Box'
import {defaultSxProp} from '../utils/defaultSxProp'

Expand DownExpand Up@@ -45,17 +44,17 @@ export const SegmentedControlIconButton: React.FC<React.PropsWithChildren<Segmen

return (
<Box as="li" sx={mergedSx}>
<Tooltip text={ariaLabel}>
<SegmentedControlIconButtonStyled
aria-current={selected}
sx={getSegmentedControlButtonStyles({selected, isIconOnly: true})}
{...rest}
>
<span className="segmentedControl-content">
<Icon />
</span>
</SegmentedControlIconButtonStyled>
</Tooltip>
{/* TODO: Once the tooltip remediations are resolved (especially https://github.com/github/primer/issues/1909) - bring it back */}
<SegmentedControlIconButtonStyled
aria-label={ariaLabel}
aria-current={selected}
sx={getSegmentedControlButtonStyles({selected, isIconOnly: true})}
{...rest}
>
<span className="segmentedControl-content">
<Icon />
</span>
</SegmentedControlIconButtonStyled>
</Box>
)
}
Expand Down