Skip to content

Button component does not pass aria-current attribute to the button element #6159

@mpalmer685

Description

@mpalmer685

Provide a general summary of the issue here

When passing the aria-current prop to the Button component, it gets filtered out and does not get passed to the HTML button element.

🤔 Expected Behavior?

If an aria-current prop is passed to the Button, it should be applied to the HTML button element.

😯 Current Behavior

Any aria-current prop passed to the Button component does not make it to the HTML button element.

💁 Possible Solution

Update useButton to include the aria-current prop in the list of ARIA props allowed to pass through.

🔦 Context

We are building a Pagination component that uses Button instead of Link because the pagination may not always be tied to the current location (e.g., simple client-side pagination). We want to apply aria-current="true" to the button representing the current page of data, but it does not get passed correctly.

🖥️ Steps to Reproduce

CodeSandbox

Version

"react-aria-components": "^1.1.1"

What browsers are you seeing the problem on?

Firefox

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions