File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ export interface LinkButtonProps<T extends ElementType = 'button'> extends AriaB
4747}
4848
4949interface AriaBaseButtonProps extends FocusableDOMProps , AriaLabelingProps {
50+ /** Indicates whether the element is disabled to users of assistive technology. */
51+ 'aria-disabled' ?: boolean | 'true' | 'false' ,
5052 /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
5153 'aria-expanded' ?: boolean | 'true' | 'false' ,
5254 /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export const Button = /*#__PURE__*/ createHideableComponent(function Button(prop
147147 ref = { ref }
148148 aria-labelledby = { ariaLabelledby }
149149 slot = { props . slot || undefined }
150- aria-disabled = { isPending ? 'true' : buttonProps [ 'aria-disabled' ] }
150+ aria-disabled = { isPending ? 'true' : ( buttonProps [ 'aria-disabled' ] ) }
151151 data-disabled = { props . isDisabled || undefined }
152152 data-pressed = { renderValues . isPressed || undefined }
153153 data-hovered = { isHovered || undefined }
Original file line number Diff line number Diff line change @@ -57,6 +57,18 @@ describe('Button', () => {
5757 expect ( button ) . toHaveAttribute ( 'aria-current' , 'page' ) ;
5858 } ) ;
5959
60+ it ( 'should not have aria-disabled defined by default' , ( ) => {
61+ let { getByRole} = render ( < Button > Test</ Button > ) ;
62+ let button = getByRole ( 'button' ) ;
63+ expect ( button ) . not . toHaveAttribute ( 'aria-disabled' ) ;
64+ } ) ;
65+
66+ it ( 'should support aria-disabled passthrough' , ( ) => {
67+ let { getByRole} = render ( < Button aria-disabled = "true" > Test</ Button > ) ;
68+ let button = getByRole ( 'button' ) ;
69+ expect ( button ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
70+ } ) ;
71+
6072 it ( 'should support slot' , ( ) => {
6173 let { getByRole} = render (
6274 < ButtonContext . Provider value = { { slots : { test : { 'aria-label' : 'test' } } } } >
You can’t perform that action at this time.
0 commit comments