Skip to content
Snippets Groups Projects
Verified Commit 1d1f54f2 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: made focusable conditional in button

parent 677bdd11
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ type ButtonProps = { ...@@ -7,6 +7,7 @@ type ButtonProps = {
image?: string; image?: string;
imageAlt?: string; imageAlt?: string;
enabled?: boolean; enabled?: boolean;
focusable?: boolean;
file?: boolean; file?: boolean;
accept?: string; accept?: string;
size?: string; size?: string;
...@@ -20,6 +21,7 @@ export const Button: FC<ButtonProps> = ({ ...@@ -20,6 +21,7 @@ export const Button: FC<ButtonProps> = ({
image, image,
imageAlt, imageAlt,
enabled = false, enabled = false,
focusable = false,
file = false, file = false,
accept = ".txt", accept = ".txt",
size = "small", size = "small",
...@@ -52,7 +54,7 @@ export const Button: FC<ButtonProps> = ({ ...@@ -52,7 +54,7 @@ export const Button: FC<ButtonProps> = ({
className={classes()} className={classes()}
onClick={onClick} onClick={onClick}
onKeyPress={onKeyPress} onKeyPress={onKeyPress}
tabIndex={0} tabIndex={focusable ? 0 : undefined}
> >
{text} {text}
</span> </span>
...@@ -62,7 +64,7 @@ export const Button: FC<ButtonProps> = ({ ...@@ -62,7 +64,7 @@ export const Button: FC<ButtonProps> = ({
className={classes()} className={classes()}
onClick={onClick} onClick={onClick}
onKeyPress={onKeyPress} onKeyPress={onKeyPress}
tabIndex={0} tabIndex={focusable ? 0 : undefined}
> >
{image && <img src={image} alt={imageAlt || text || "button"} />} {image && <img src={image} alt={imageAlt || text || "button"} />}
{file && ( {file && (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment