fix: switch fields aren't accessible with tab on Safari (#45083)

## Problem

Similar to #45064, switch fields aren't accessible with tab on Safari.

Example:
- Open
https://studio-staging-git-gildasgarcia-fe-2998-suggest-e7fb9e-supabase.vercel.app
- Create a new project
- Move through fields with tab, note that you can't focus _High
Availability_

## Solution

- Add a `tabindex="0"` on `<Switch>`
- Add a `tabindex="0"` on `<Toggle>` (was a mistake as we don't actually
use it yet but it will be needed when we do)


## How to test

- Open the staging
- Create a new project
- Move through fields with tab, note that you can focus _High
Availability_

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Switch and Toggle controls now correctly participate in keyboard tab
order, improving focusability and keyboard navigation for accessibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Gildas Garcia authored and GitHub committed 2026-04-21 09:45:34 +02:00
1 parent f5933ad87f
commit cf3569c16d
2 files changed
+2

No files matched your search

@@ -50,6 +50,7 @@ const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitives.Root>,
({ className, size, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(switchRootVariants({ size }), className)}
tabIndex={0}
{...props}
ref={ref}
>
@@ -35,6 +35,7 @@ const Toggle = React.forwardRef<
<TogglePrimitive.Root
ref={ref}
className={cn(toggleVariants({ variant, size, className }))}
tabIndex={0}
{...props}
/>
))