From 3556dcbfd3a33d1b7bd5bf45974183a231801d19 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 5 Mar 2025 23:40:33 +0700 Subject: [PATCH] removed annoying focus on buttons 2 --- frontend/realtime/src/app/global.css | 15 +++++++++++++++ .../src/components/features/ToolbarButton.tsx | 8 +++++++- frontend/realtime/src/components/ui/Button.tsx | 9 ++++----- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/frontend/realtime/src/app/global.css b/frontend/realtime/src/app/global.css index 077379a221..3c0abd0ee7 100644 --- a/frontend/realtime/src/app/global.css +++ b/frontend/realtime/src/app/global.css @@ -6,6 +6,21 @@ :root { @apply select-none bg-ui-background font-sans text-white; } + + /* Remove all focus styles */ + button { + @apply outline-none ring-0; + -webkit-tap-highlight-color: transparent !important; + outline: none !important; + box-shadow: none !important; + } + + button:focus { + @apply outline-none ring-0; + outline: none !important; + box-shadow: none !important; + } + .pegboard { background-image: radial-gradient(#ffffff25 1px, transparent 0); background-color: #1b1b1f; diff --git a/frontend/realtime/src/components/features/ToolbarButton.tsx b/frontend/realtime/src/components/features/ToolbarButton.tsx index e8694ccf03..fadc860c35 100644 --- a/frontend/realtime/src/components/features/ToolbarButton.tsx +++ b/frontend/realtime/src/components/features/ToolbarButton.tsx @@ -44,7 +44,7 @@ export const ToolbarButton = ({ } const mergedButtonClasses = twMerge( - "rounded-lg hover:bg-white/15 transition-all duration-100 border-2 border-transparent text-white/80 px-2 focus-visible:ring-0 focus-visible:ring-offset-0", + "rounded-lg hover:bg-white/15 transition-all duration-100 border-2 border-transparent text-white/80 px-2", children ? "w-fit flex items-center gap-2.5 text-nowrap" : "size-10", active && "bg-primary/30 border-2 border-primary hover:bg-primary/30", disabled && "pointer-events-none text-secondary-300", @@ -58,6 +58,12 @@ export const ToolbarButton = ({ className={mergedButtonClasses} disabled={disabled} autoFocus={false} + tabIndex={-1} + style={{ + outline: "none", + boxShadow: "none", + WebkitTapHighlightColor: "transparent", + }} {...restButtonProps} onClick={(e) => { e.preventDefault(); diff --git a/frontend/realtime/src/components/ui/Button.tsx b/frontend/realtime/src/components/ui/Button.tsx index be875daaf2..fe83115ce5 100644 --- a/frontend/realtime/src/components/ui/Button.tsx +++ b/frontend/realtime/src/components/ui/Button.tsx @@ -28,17 +28,17 @@ export const Button = ({ function getVariantClassNames(variant: string) { switch (variant) { case "tertiary": { - return "bg-tertiary hover:bg-tertiary-400 text-white focus-visible:outline-tertiary-600"; + return "bg-tertiary hover:bg-tertiary-400 text-white"; } case "secondary": { - return "bg-ui-controls hover:bg-ui-controls/80 text-white focus-visible:outline-secondary"; + return "bg-ui-controls hover:bg-ui-controls/80 text-white"; } case "action": { - return " bg-action hover:bg-action-500 text-white focus-visible:outline-action"; + return "bg-action hover:bg-action-500 text-white"; } case "primary": default: { - return "bg-primary hover:bg-primary-600 text-white focus-visible:outline-primary-600"; + return "bg-primary hover:bg-primary-600 text-white"; } } } @@ -51,7 +51,6 @@ export const Button = ({ "text-[15px] font-semibold rounded-lg px-3 py-2 shadow-sm", "flex gap-2 items-center justify-center", "transition-all duration-150", - "focus-visible:ring-0 focus-visible:ring-offset-0", getVariantClassNames(propsVariant), propsClassName, disabledClass,