From 1d1f54f2f8135dcf4ba91472d7dd6bd86795ba5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Wed, 9 Nov 2022 01:15:02 +0000
Subject: [PATCH] feat: made focusable conditional in button

---
 examples/web/react/components/button/button.tsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/web/react/components/button/button.tsx b/examples/web/react/components/button/button.tsx
index 4778c405..27a15fcb 100644
--- a/examples/web/react/components/button/button.tsx
+++ b/examples/web/react/components/button/button.tsx
@@ -7,6 +7,7 @@ type ButtonProps = {
     image?: string;
     imageAlt?: string;
     enabled?: boolean;
+    focusable?: boolean;
     file?: boolean;
     accept?: string;
     size?: string;
@@ -20,6 +21,7 @@ export const Button: FC<ButtonProps> = ({
     image,
     imageAlt,
     enabled = false,
+    focusable = false,
     file = false,
     accept = ".txt",
     size = "small",
@@ -52,7 +54,7 @@ export const Button: FC<ButtonProps> = ({
             className={classes()}
             onClick={onClick}
             onKeyPress={onKeyPress}
-            tabIndex={0}
+            tabIndex={focusable ? 0 : undefined}
         >
             {text}
         </span>
@@ -62,7 +64,7 @@ export const Button: FC<ButtonProps> = ({
             className={classes()}
             onClick={onClick}
             onKeyPress={onKeyPress}
-            tabIndex={0}
+            tabIndex={focusable ? 0 : undefined}
         >
             {image && <img src={image} alt={imageAlt || text || "button"} />}
             {file && (
-- 
GitLab