Skip to content

[Button] Button applying "role=button" to links #4021

@mrmckeb

Description

@mrmckeb

Bug report

Current behavior

When using a non-button element with nativeButton={false}, role="button" is always applied.

I realise that this is a helper for accessibility, but I would expect a link to retain it's accessible role.

Expected behavior

The component already checks the element type, and could perhaps only apply the role to non-links?

Reproducible example

https://ui.shadcn.com/docs/components/base/button#link-1

Base UI version

1.1.0

Which browser are you using?

Chrome (and others)

Which OS are you using?

macOs

Which assistive tech are you using (if applicable)?

N/A

Additional context

See the Radix example:
https://ui.shadcn.com/docs/components/radix/button#link-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: buttonChanges related to the button component.type: expected behaviorThe current behavior is already the one expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions