Skip to content
Merged
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/components/Button/UnstyledButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ export const UnstyledButton = forwardRef(function UnstyledButton<

return (
<Component
// The elements roles should be set to button default, or link in the case of anchors.
// This should be overridable by props, say for example if you want to use a button as an option within a listbox.
// Hence it taking precedence over restProps.
role={as === "a" ? "link" : "button"}
{...restProps}
ref={ref as Ref<C>}
className={className}
// All elements roles should be overriden at the exceptions of anchors
// We want them to behave like links but look like buttons
role={as === "a" ? "link" : "button"}
tabIndex={0}
{...eventHandlers}
aria-disabled={disabled}
Expand Down
Loading