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
1 change: 1 addition & 0 deletions packages/@react-aria/button/src/useButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function useButton(props: AriaButtonOptions<ElementType>, 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);
Expand Down
2 changes: 2 additions & 0 deletions packages/@react-types/button/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 6 additions & 0 deletions packages/react-aria-components/test/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ describe('Button', () => {
expect(button).toHaveAttribute('formMethod', 'post');
});

it('should support accessibility props', () => {
let {getByRole} = render(<Button aria-current="page">Test</Button>);
let button = getByRole('button');
expect(button).toHaveAttribute('aria-current', 'page');
});

it('should support slot', () => {
let {getByRole} = render(
<ButtonContext.Provider value={{slots: {test: {'aria-label': 'test'}}}}>
Expand Down
Loading