Skip to content

Commit

Permalink
make buttons take focus so the blur events work
Browse files Browse the repository at this point in the history
HTML is a cheeky rascal
  • Loading branch information
ryanflorence committed Dec 30, 2023
1 parent e6e1df6 commit 8075092
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/routes/board.$id/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export let SaveButton = forwardRef<
return (
<button
ref={ref}
// this makes it so the button takes focus on clicks in safari I can't
// remember if this is the proper workaround or not, it's been a while!
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
// https://bugs.webkit.org/show_bug.cgi?id=22261
tabIndex={0}
{...props}
className="text-sm rounded-lg text-left p-2 font-medium text-white bg-brand-blue"
/>
Expand All @@ -23,6 +28,7 @@ export let CancelButton = forwardRef<
<button
ref={ref}
type="button"
tabIndex={0}
{...props}
className="text-sm rounded-lg text-left p-2 font-medium hover:bg-slate-200 focus:bg-slate-200"
/>
Expand Down

0 comments on commit 8075092

Please sign in to comment.