Skip to content

Commit

Permalink
Fixing button tabability for accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
torrinworx committed Dec 26, 2024
1 parent a4341fc commit 2e2486a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/inputs/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ export default ThemeContext.use(h => {
onMouseUp(event);
}
}}
onKeyDown={(event) => {
if (!disabled.get() && (event.key === "Enter" || event.key === " ")) {
event.preventDefault();
createRipple(event);
if (onClick) onClick(event);
if (onMouseDown) onMouseDown(event);
}
}}
isHovered={hover}
style={{
display: inline ? 'inline-flex' : 'flex',
Expand Down

0 comments on commit 2e2486a

Please sign in to comment.