diff --git a/packages/@react-aria/button/src/useButton.ts b/packages/@react-aria/button/src/useButton.ts index 3cd988db95f..0ba0684f5d2 100644 --- a/packages/@react-aria/button/src/useButton.ts +++ b/packages/@react-aria/button/src/useButton.ts @@ -107,6 +107,7 @@ export function useButton(props: AriaButtonOptions, ref: RefObject< 'aria-expanded': props['aria-expanded'], 'aria-controls': props['aria-controls'], 'aria-pressed': props['aria-pressed'], + 'aria-current': props['aria-current'], onClick: (e) => { if (deprecatedOnClick) { deprecatedOnClick(e); diff --git a/packages/@react-types/button/src/index.d.ts b/packages/@react-types/button/src/index.d.ts index f3f68ca2221..247312cfd3c 100644 --- a/packages/@react-types/button/src/index.d.ts +++ b/packages/@react-types/button/src/index.d.ts @@ -55,6 +55,8 @@ interface AriaBaseButtonProps extends FocusableDOMProps, AriaLabelingProps { 'aria-controls'?: string, /** Indicates the current "pressed" state of toggle buttons. */ 'aria-pressed'?: boolean | 'true' | 'false' | 'mixed', + /** Indicates whether this element represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | 'time', /** * The behavior of the button when used in an HTML form. * @default 'button' diff --git a/packages/react-aria-components/test/Button.test.js b/packages/react-aria-components/test/Button.test.js index 1d16303fa07..6570b35f539 100644 --- a/packages/react-aria-components/test/Button.test.js +++ b/packages/react-aria-components/test/Button.test.js @@ -51,6 +51,12 @@ describe('Button', () => { expect(button).toHaveAttribute('formMethod', 'post'); }); + it('should support accessibility props', () => { + let {getByRole} = render(); + let button = getByRole('button'); + expect(button).toHaveAttribute('aria-current', 'page'); + }); + it('should support slot', () => { let {getByRole} = render(