Skip to content

Commit 5553be3

Browse files
committed
Add aria-disabled attribute to button
When the button is disabled, it should be marked as aria-disabled. This also clears the color contrast violation for the 50% opacity as the element is semantically marked as disabled.
1 parent 8345897 commit 5553be3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/button/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const Button: React.FC<ButtonType> = (props) => {
2626
const content = getContent(children, ButtonIcon)
2727

2828

29-
return <a {...args} className={`button button--${variant} ${active ? "button--active" : ""} ${disabled ? "button--disabled" : ""}`}>
29+
return <a {...args} className={`button button--${variant} ${active ? "button--active" : ""} ${disabled ? "button--disabled" : ""}`}
30+
aria-disabled={disabled ? "true" : "false"}>
3031
{icon}
3132
{content ? <span className={"button__content"}>{content}</span> : null}
3233
</a>

0 commit comments

Comments
 (0)