File tree Expand file tree Collapse file tree 5 files changed +15
-15
lines changed
packages/react/src/SegmentedControl Expand file tree Collapse file tree 5 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const WithDisabledButtons = () => (
1515 < SegmentedControl . Button aria-label = { 'Raw' } leadingIcon = { FileCodeIcon } >
1616 Raw
1717 </ SegmentedControl . Button >
18- < SegmentedControl . Button aria-label = { 'Blame' } leadingIcon = { PeopleIcon } disabled >
18+ < SegmentedControl . Button aria-label = { 'Blame' } leadingIcon = { PeopleIcon } aria- disabled= { true } >
1919 Blame
2020 </ SegmentedControl . Button >
2121 </ SegmentedControl >
Original file line number Diff line number Diff line change @@ -167,15 +167,21 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({
167167 const sharedChildProps = {
168168 onClick : onChange
169169 ? ( event : React . MouseEvent < HTMLButtonElement > ) => {
170- const isDisabled = child . props . disabled === true || child . props [ 'aria-disabled' ] === true
170+ const isDisabled =
171+ child . props . disabled === true ||
172+ child . props [ 'aria-disabled' ] === 'true' ||
173+ child . props [ 'aria-disabled' ] === true
171174 if ( ! isDisabled ) {
172175 onChange ( index )
173176 isUncontrolled && setSelectedIndexInternalState ( index )
174177 child . props . onClick && child . props . onClick ( event )
175178 }
176179 }
177180 : ( event : React . MouseEvent < HTMLButtonElement > ) => {
178- const isDisabled = child . props . disabled === true || child . props [ 'aria-disabled' ] === true
181+ const isDisabled =
182+ child . props . disabled === true ||
183+ child . props [ 'aria-disabled' ] === 'true' ||
184+ child . props [ 'aria-disabled' ] === true
179185 if ( ! isDisabled ) {
180186 child . props . onClick && child . props . onClick ( event )
181187 isUncontrolled && setSelectedIndexInternalState ( index )
Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ export type SegmentedControlButtonProps = {
1919 leadingIcon ?: React . FunctionComponent < React . PropsWithChildren < IconProps > > | React . ReactElement
2020 /** Applies `aria-disabled` to the button. This will disable certain functionality, such as `onClick` events. */
2121 disabled ?: boolean
22- /** Applies `aria-disabled` to the button. This will disable certain functionality, such as `onClick` events. */
23- 'aria-disabled' ?: boolean
2422 /** Optional counter to display on the right side of the button */
2523 count ?: number | string
2624} & ButtonHTMLAttributes < HTMLButtonElement | HTMLLIElement >
@@ -31,12 +29,13 @@ const SegmentedControlButton: FCWithSlotMarker<React.PropsWithChildren<Segmented
3129 selected,
3230 className,
3331 disabled,
34- 'aria-disabled' : ariaDisabled ,
3532 // Note: this value is read in the `SegmentedControl` component to determine which button is selected but we do not need to apply it to an underlying element
3633 defaultSelected : _defaultSelected ,
3734 count,
38- ...rest
35+ ...props
3936} ) => {
37+ const { 'aria-disabled' : ariaDisabled , ...rest } = props
38+
4039 return (
4140 < li className = { clsx ( classes . Item ) } data-selected = { selected ? '' : undefined } >
4241 < button
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ export default {
1414 selected : false ,
1515 defaultSelected : false ,
1616 disabled : false ,
17- 'aria-disabled' : false ,
1817 } ,
1918 argTypes : {
2019 icon : {
@@ -31,9 +30,6 @@ export default {
3130 disabled : {
3231 type : 'boolean' ,
3332 } ,
34- 'aria-disabled' : {
35- type : 'boolean' ,
36- } ,
3733 } ,
3834 decorators : [
3935 Story => {
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ export type SegmentedControlIconButtonProps = {
2222 tooltipDirection ?: TooltipDirection
2323 /** Whether the button is disabled. */
2424 disabled ?: boolean
25- /** Whether the button is aria-disabled. */
26- 'aria-disabled' ?: boolean
2725} & ButtonHTMLAttributes < HTMLButtonElement | HTMLLIElement >
2826
2927export const SegmentedControlIconButton : FCWithSlotMarker < React . PropsWithChildren < SegmentedControlIconButtonProps > > = ( {
@@ -34,9 +32,10 @@ export const SegmentedControlIconButton: FCWithSlotMarker<React.PropsWithChildre
3432 description,
3533 tooltipDirection,
3634 disabled,
37- 'aria-disabled' : ariaDisabled ,
38- ...rest
35+ ...props
3936} ) => {
37+ const { 'aria-disabled' : ariaDisabled , ...rest } = props
38+
4039 return (
4140 < li className = { clsx ( classes . Item , className ) } data-selected = { selected || undefined } >
4241 < Tooltip
You can’t perform that action at this time.
0 commit comments