Repository navigation
Conversation
Extend the Button Safari focus default to other high-traffic triggers and add a ratcheted eslint rule so raw button call sites don't regress.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change adds an ESLint rule requiring explicit ChangesSafari tabindex enforcement
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/components/shadcn/ui/command.tsx`:
- Around line 72-73: Update the reset button alongside CommandInput so it
inherits the input’s disabled state and is not explicitly placed in the tab
sequence when disabled. Preserve normal reset-button interaction and focus
behavior when the input is enabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 53e57937-57ed-448b-8f9d-4749c2b06e6b
📒 Files selected for processing (17)
apps/design-system/content/docs/accessibility.mdxapps/studio/.github/eslint-rule-baselines.jsonapps/studio/scripts/ratchet-rules.jsonpackages/eslint-config-supabase/next.jspackages/eslint-config-supabase/rules/require-safari-tabindex.jspackages/ui/src/components/shadcn/ui/accordion.tsxpackages/ui/src/components/shadcn/ui/alert-dialog.tsxpackages/ui/src/components/shadcn/ui/button.tsxpackages/ui/src/components/shadcn/ui/checkbox.tsxpackages/ui/src/components/shadcn/ui/collapsible.tsxpackages/ui/src/components/shadcn/ui/command.tsxpackages/ui/src/components/shadcn/ui/dialog.tsxpackages/ui/src/components/shadcn/ui/dropdown-menu.tsxpackages/ui/src/components/shadcn/ui/popover.tsxpackages/ui/src/components/shadcn/ui/sheet.tsxpackages/ui/src/components/shadcn/ui/sidebar.tsxpackages/ui/src/components/shadcn/ui/table.tsx
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
🎭 Playwright Test Results (next)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
…s-for-interactive-primitives-lint
There was a problem hiding this comment.
Pull request overview
This PR improves Safari keyboard navigation in the shared shadcn/Radix UI primitives by defaulting interactive triggers/controls to tabIndex={0} (and -1 when disabled in most cases), and introduces a custom ESLint rule to prevent regressions from raw <button> / role="button" usage without an explicit tabIndex. It also updates Studio’s lint ratchet baseline and the design-system accessibility docs to document the new defaults.
Changes:
- Add Safari-friendly
tabIndexdefaults across multiple UI primitives (Checkbox, Accordion/Collapsible triggers, Dialog/Sheet/Popover/DropdownMenu triggers, sidebar actions, and table header sort). - Add
supabase/require-safari-tabindexESLint rule and wire it into the shared Next.js ESLint config; ratchet it in Studio with an initial baseline. - Update design-system accessibility documentation to list primitives that now bake in the Safari
tabIndexbehavior.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/src/components/shadcn/ui/table.tsx | Makes table header sort control tabbable in Safari via tabIndex={0}. |
| packages/ui/src/components/shadcn/ui/sidebar.tsx | Ensures sidebar menu/action buttons default to Safari-tabbable tabIndex, including disabled handling. |
| packages/ui/src/components/shadcn/ui/sheet.tsx | Wraps SheetTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/popover.tsx | Wraps PopoverTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/dropdown-menu.tsx | Wraps DropdownMenuTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/dialog.tsx | Wraps DialogTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/command.tsx | Adds type="button" and Safari tabbability for the reset icon button in CommandInput. |
| packages/ui/src/components/shadcn/ui/collapsible.tsx | Wraps CollapsibleTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/checkbox.tsx | Adds Safari-friendly tabIndex default to Checkbox root, respecting disabled state. |
| packages/ui/src/components/shadcn/ui/button.tsx | Adds Safari-friendly tabIndex default to Button, respecting disabled state and preserving overrides. |
| packages/ui/src/components/shadcn/ui/alert-dialog.tsx | Wraps AlertDialogTrigger to default tabIndex (and -1 when disabled). |
| packages/ui/src/components/shadcn/ui/accordion.tsx | Updates AccordionTrigger to default tabIndex (and -1 when disabled). |
| packages/eslint-config-supabase/rules/require-safari-tabindex.js | Adds a new ESLint rule to require explicit tabIndex on raw <button> / role="button". |
| packages/eslint-config-supabase/next.js | Registers the new rule in the Supabase ESLint plugin and enables it (warn) for TS/TSX. |
| apps/studio/scripts/ratchet-rules.json | Adds the new rule to Studio’s ratchet list. |
| apps/studio/.github/eslint-rule-baselines.json | Establishes the Studio baseline count for the new rule (82 existing violations). |
| apps/design-system/content/docs/accessibility.mdx | Documents which primitives now bake in the Safari tabIndex default. |
Comments suppressed due to low confidence (1)
packages/ui/src/components/shadcn/ui/command.tsx:78
- The reset icon button is always rendered when
showResetIconis true, and is only hidden viaopacity-0. With the newtabIndex={0}Safari will now allow keyboard focus to land on an invisible control when the input value is empty, which is confusing for keyboard users. Consider removing it from the tab order (and disabling it) when there’s no value to clear.
<button
type="button"
tabIndex={0}
onClick={handleReset}
className={cn(
'text-foreground-lighter hover:text-foreground-light hover:cursor-pointer transition-all opacity-0 duration-100',
!!props.value?.length && 'opacity-100'
)}
Also Title Case component names in the accessibility docs prose.
Lead with what we set (explicit tabIndex) and keep Safari as the why in docs and comments.
Share the explicit tabIndex default across Button and interactive primitives so the Safari keyboard-focus rule lives in one place.
There was a problem hiding this comment.
Extracted to reduce repetition in the same file of:
const computedTabIndex = tabIndex !== undefined ? tabIndex : disabled ? -1 : 0| "jsx-a11y/heading-has-content": 2, | ||
| "jsx-a11y/no-distracting-elements": 0 | ||
| "jsx-a11y/no-distracting-elements": 0, | ||
| "supabase/require-explicit-tabindex": 82 |
There was a problem hiding this comment.
82 allowed leftovers for this rule right now, as per the PR description. Shrinking this number is follow-up work.
This and the below lines will be shrinked in future work.
joshenlim
left a comment
There was a problem hiding this comment.
Tested on preview as per instructions! 🙏
Braintrust eval report
|
## What kind of change does this PR introduce? A11y cleanup follow-up to #47984 / [DEPR-626](https://linear.app/supabase/issue/DEPR-626). ## What is the current behavior? Studio had 82 ratcheted `supabase/require-explicit-tabindex` violations (raw `<button>` / `role="button"` without explicit `tabIndex`). ## What is the new behavior? - Explicit `tabIndex={0}` (or disabled → `-1`) on those Studio call sites across nav, `components/ui`, Database, Storage, and the remainder - Ratchet baseline cleared (**82 → 0**) and the rule **removed from the Studio ratchet** (debt is gone; ratchet is temporary) - Rule remains a shared **`warn`** for now — promoting to `error` (and sweeping www/docs/design-system) is a follow-up - Also fixed the learn/ui-library call sites that surfaced while experimenting with error promotion - Small follow-ups where making controls focusable exposed gaps: accessible names, disabled/focus consistency, focus-ring polish on To-test surfaces, home section `KeyboardSensor`, and an E2E locator tightened after `aria-label="Remove column"` Prefer migrating to `Button` from `ui` in future touch-ups; this PR takes the minimal path so Studio debt can stay at zero. ## Additional context Batches landed together so baseline conflicts stayed simple while chipping away: - Hotspots / nav (FirstLevelNav, Marketplace, AttachmentUpload, Column, Tabs, …) - `components/ui` shared - Database + Storage - Remainder **Out of scope / intentional deferrals** - Promoting `supabase/require-explicit-tabindex` to a lint **error** (follow-up after www/docs/design-system sweeps) - Tabs/Radio roving, tooltips, context menus, in-menu items - Full keyboard-accessible tab-close UX (close stays hover + `tabIndex={-1}`; context menu still closes tabs) - Data API docs links (`/project/<ref>/api` redirect) **Reviewer notes** - Rule only flags raw `<button>` / `role="button"` without a `tabIndex` prop. `Button` from `ui` already bakes this in - `tabIndex={-1}` is intentional for disabled controls, in-menu / roving-focus children, and hover-only tab close - For dnd-kit grips, put `tabIndex` **after** `{...attributes}` so it isn’t overwritten (TS2783) ### To test Use **Safari** with macOS Keyboard navigation **off** (System Settings → Keyboard). Chrome once for a sanity pass. For each surface below: Tab until the control is focused, then activate with Enter/Space where relevant. 1. **API Docs side panel** (Table Editor → open a table → **API docs**) - Floating API Docs panel — **not** `/project/<ref>/api` (that redirects to Data API docs; language ToggleGroup uses arrow keys; links are out of scope) - Left nav buttons — Tab through several and activate one; active highlight / navigation still works 2. **Integrations → Marketplace** - Enable **Integrations layout** feature preview first (avatar menu → Feature previews) - `/org/<slug>/integrations` or project integrations marketplace - “Clear all”, grid/list toggles — Tab + activate 3. **Table Editor → create a table → Columns** - Drag handles only appear while **creating** (not when editing an existing table) - Tab to grip / remove (X) / sensitive-data eye if shown 4. **Project Home** — section drag handles - Tab to a grip (visible focus ring) - Optional: Space to pick up, arrows to move, Space/Esc to drop (KeyboardSensor added) - Mouse dnd still works 5. **Storage → Policies** — expand/collapse bucket list chevron (design-system focus ring, no stuck grey open bg) 6. **Support form** (Help → Support) — attachment remove (×) and add-attachment control when visible Disabled controls should be **skipped** by Tab. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Accessibility Improvements** * Improved keyboard navigation throughout Studio by explicitly managing focus (`tabIndex`) across many interactive controls (menus, tabs, tables, charts, dialogs, navigation, and form actions). * Disabled or non-interactive controls are now removed from the tab order (or made unfocusable), while available actions remain reachable. * Ensured `type="button"` on relevant controls to prevent unintended submissions, and refined keyboard focus behavior for various toggles and copy/remove actions. * **Chores** * Updated the ESLint rule baseline configuration to match the new focus behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What kind of change does this PR introduce? Accessibility / lint hardening (Safari keyboard focus). ## What is the current behavior? `supabase/require-explicit-tabindex` is `'warn'`. Studio’s ratchet was at 0 but the rule was still ratcheted; www / docs / design-system still had raw `<button>` / `role="button"` call sites without an explicit `tabIndex`. [DEPR-627](https://linear.app/supabase/issue/DEPR-627) · follow-up to #47984 / #48040 ## What is the new behavior? - Shared config: `'supabase/require-explicit-tabindex': 'error'` - Swept www / docs / design-system (+ Studio test fixtures the ratchet skipped) - Removed the rule from the Studio ratchet + baselines ## To test Prefer **Safari**. This PR only adds explicit `tabIndex` to raw `<button>` / `role="button"` call sites — not links, and not controls that already go through `Button` from `ui`. ### Marketing (`www`) ([staging link](https://zone-www-dot-com-git-danny-depr-627-promote-req-7ae43c-supabase.vercel.app/)) - [x] Homepage frameworks / dashboard feature tabs — Tab through each tab button - [x] Product pages (e.g. `/auth`, `/database`) — section tab switchers - [x] Narrow viewport — open the hamburger; Tab through menu buttons - [x] `/partners/catalog` — filter / view controls - [x] Blog view toggle (list ↔ grid) ### Docs ([staging link](https://docs-git-danny-depr-627-promote-require-explici-25e46d-supabase.vercel.app/)) - [x] **Desktop (≥ lg):** top-right **⋯ menu** (hamburger icon) — opens a dropdown that includes Theme. Not a separate theme button. - [x] **Mobile (< lg):** top-right **hamburger** opens the sheet; close (X) is the raw button we tagged. Theme inside the sheet uses `ThemeToggle` / `DropdownMenuTrigger` from `ui` (already supposed to set `tabIndex`). - [x] **Code blocks** — copy / language controls - [x] **Is this helpful?** — X / check are `Button` from `ui` (should already Tab). After voting **while signed in**, the follow-up “What went well?” / “How can we improve?” text button is the raw one we tagged. - [x] **AI Tools → Copy as Markdown** (right rail on a guide) — this is the only GuidesSidebar control this PR changed. “On this page” TOC items are **links**, not covered by this lint. - [x] **Reference docs** (e.g. JS client reference) — section headers that expand/collapse in the left nav (`Collapsible.Trigger`) - [x] **Troubleshooting index** — type in the search field, then Tab to the **clear (X)** control ### Dashboard (`studio`) No production UI changes in this PR (tests + lint config only). Quick Safari smoke that prior tabindex work still holds: - [x] Project sidebar — Tab through primary nav links - [x] Settings → General — Tab through inputs / buttons - [x] Storage → Files — Tab a bucket row / file actions
What kind of change does this PR introduce?
A11y fix for keyboard focus (esp. Safari), plus a lint rule to keep it from regressing.
What is the current behavior?
Buttonalready defaults an explicittabIndex={0}(#40458). Other interactive primitives (Checkbox, bare triggers, etc.) still skip Tab focus in Safari unless macOS Keyboard navigation is on. Raw<button>call sites have no guardrail.What is the new behavior?
tabIndexdefault baked into Checkbox, Accordion Trigger, Collapsible Trigger, Dropdown Menu / Popover / Dialog / Sheet / Alert Dialog triggers, Table Head Sort, Command reset, sidebar actions, and shadcn Buttonsupabase/require-explicit-tabindexESLint rule, ratcheted in Studio (82 existing violations)Resolves DEPR-621
Additional context
To test
Use Safari with macOS Keyboard navigation off (the default). Chrome once for a sanity pass.
Storage → Files bucket (list view) — Checkbox
columnFiles.length === 0).Storage → Analytics bucket → bucket details — Accordion Trigger
On an Analytics bucket with no tables yet, Tab to the “Create your first table via PyIceberg” Accordion Triggers and open/close with Enter/Space.
Elsewhere (light smoke)
*Trigger asChild><Button>(Sheets, Dialogs, menus) still one Tab stop; open/close fineLater
Chip-away of the 82 raw Studio buttons (and remove exceptions from rule). Prefer migrating those to
Buttonfromuilater.Summary by CodeRabbit
tabIndex={-1}, while enabled controls default totabIndex={0}.tabIndexhandling for command reset and table sort header controls.getExplicitTabIndexutility used by UI components to standardize focus behavior.tabIndexon raw button-like elements, with corresponding baseline updates.