Skip to content

fix sheets stealing focus - #48521

Merged
dnywh merged 1 commit into
masterfrom
dnywh/fix/depr-539-sheet-focus
Aug 3, 2026
Merged

dnywh merged 1 commit into
masterfrom
dnywh/fix/depr-539-sheet-focus

Conversation

@dnywh

@dnywh dnywh commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix. Resolves DEPR-539.

What is the current behavior?

When a focused child unmounts, Radix can move focus to the Sheet wrapper and break the expected tab order. Several callsites suppress the wrapper's tabindex individually.

What is the new behavior?

Sheet still focuses its first interactive child when opened, but the wrapper itself is no longer focusable by default. Callers can opt in with an explicit tabIndex when needed.

Additional context

Testing

Compare this Studio experience on both this branch and master:

  1. Open any project with an Edge Function.
  2. Go to Edge Functions, open the function, then click Test.
  3. Under Headers, click Add Headers. Click the first header key input, then Tab slowly through the header inputs and remove buttons.

On master, focus can jump to the whole Sheet. On this branch, focus stays on the controls in order.

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard focus behavior across sheets and panels.
    • Sheets now focus the first available interactive element when opened, without adding unnecessary focus targets.
    • Preserved support for programmatic focus and prevented focus from unexpectedly moving to the sheet when focused content is removed.
    • Updated authentication, integrations, connection, logging, storage, and other sheet interfaces consistently.

@vercel

vercel Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview Jul 31, 2026 5:14am
docs Ready Ready Preview, v0 Jul 31, 2026 5:14am
studio-self-hosted Ready Ready Preview Jul 31, 2026 5:14am
studio-staging Ready Ready Preview Jul 31, 2026 5:14am
ui-library Ready Ready Preview Jul 31, 2026 5:14am
zone-www-dot-com Ready Ready Preview, v0 Jul 31, 2026 5:14am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 31, 2026 5:14am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c609ceeb-f19f-481a-88da-bcf4e1b13446

📥 Commits

Reviewing files that changed from the base of the PR and between 78957bc and 3f3d7e9.

📒 Files selected for processing (12)
  • apps/studio/components/interfaces/Auth/CustomAuthProviders/CreateOrUpdateCustomProviderSheet.tsx
  • apps/studio/components/interfaces/Auth/OAuthApps/CreateOrUpdateOAuthAppSheet.tsx
  • apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx
  • apps/studio/components/interfaces/Integrations/Queues/CreateQueueSheet/CreateQueueSheet.tsx
  • apps/studio/components/interfaces/Integrations/Wrappers/OverviewTab.tsx
  • apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsx
  • apps/studio/components/interfaces/Integrations/Wrappers/WrappersTab.tsx
  • apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/OverviewTab.tsx
  • apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx
  • apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx
  • packages/ui/src/components/shadcn/ui/sheet.test.tsx
  • packages/ui/src/components/shadcn/ui/sheet.tsx
💤 Files with no reviewable changes (2)
  • apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx
  • apps/studio/components/interfaces/Auth/OAuthApps/CreateOrUpdateOAuthAppSheet.tsx

📝 Walkthrough

Walkthrough

SheetContent now handles the undefined tab index internally. Ten Studio sheet consumers remove redundant tabIndex={undefined} props. Tests cover default focus, explicit programmatic focusability, and focused-child removal.

Changes

SheetContent focus behavior

Layer / File(s) Summary
SheetContent tabIndex behavior
packages/ui/src/components/shadcn/ui/sheet.tsx, packages/ui/src/components/shadcn/ui/sheet.test.tsx
SheetContent passes tabIndex={undefined} to the underlying primitive. Tests cover default focus, tabIndex={-1}, and focused-child removal.
Studio SheetContent usage
apps/studio/components/interfaces/Auth/..., apps/studio/components/interfaces/ConnectSheet/..., apps/studio/components/interfaces/Integrations/..., apps/studio/components/interfaces/LogDrains/..., apps/studio/components/interfaces/Storage/...
Studio sheets remove redundant tabIndex={undefined} props while preserving existing sheet configuration.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: kemaldotearth

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: preventing Sheets from stealing focus.
Description check ✅ Passed The description covers the change type, current behavior, new behavior, issue, and testing, but omits the CONTRIBUTING.md confirmation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dnywh/fix/depr-539-sheet-focus

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 31, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@dnywh
dnywh requested a review from Copilot July 31, 2026 05:11
@dnywh
dnywh marked this pull request as ready for review July 31, 2026 05:13
@dnywh
dnywh requested review from a team as code owners July 31, 2026 05:13
size="lg"
showClose={false}
className="flex flex-col gap-0"
tabIndex={undefined}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tabIndex={undefined} (and all the other removed ones in other files below) was a caller-level workaround.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the shared SheetContent (Radix-based sheet) to prevent the sheet wrapper from becoming focusable by default, fixing cases where focus jumps to the wrapper after a focused child unmounts and disrupts tab order across Studio sheets.

Changes:

  • Set SheetContent’s default tabIndex to undefined (non-focusable wrapper), while still allowing callers to opt-in by passing an explicit tabIndex.
  • Add SheetContent behavior tests covering initial autofocus, explicit tabIndex opt-in, and avoiding wrapper-focus after child removal.
  • Remove now-unnecessary tabIndex={undefined} overrides from multiple Studio sheet call sites.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ui/src/components/shadcn/ui/sheet.tsx Makes the sheet wrapper non-focusable by default via tabIndex={undefined}, preserving opt-in override via props.
packages/ui/src/components/shadcn/ui/sheet.test.tsx Adds regression tests for focus behavior and explicit wrapper focusability opt-in.
apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Integrations/Wrappers/WrappersTab.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Integrations/Wrappers/OverviewTab.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/OverviewTab.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Integrations/Queues/CreateQueueSheet/CreateQueueSheet.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Auth/OAuthApps/CreateOrUpdateOAuthAppSheet.tsx Removes redundant tabIndex={undefined} on SheetContent.
apps/studio/components/interfaces/Auth/CustomAuthProviders/CreateOrUpdateCustomProviderSheet.tsx Removes redundant tabIndex={undefined} on SheetContent.

<SheetPrimitive.Content
ref={ref}
className={cn(sheetVariants({ side, size }), className)}
tabIndex={undefined}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So SheetContent is now no longer programmatically focusable by default. This should be the experience in almost all cases anyway: interactive content should get focus.

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (next)

passed  243 passed
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  3 minutes, 49 seconds
commit  3f3d7e9

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@kemaldotearth kemaldotearth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as intended :shipit:

@dnywh
dnywh merged commit e779631 into master Aug 3, 2026
41 checks passed
@dnywh
dnywh deleted the dnywh/fix/depr-539-sheet-focus branch August 3, 2026 00:01
@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1785715507)

Score Average Improvements Regressions
Completeness 100% (+34pp) 16 🟢 -
Conciseness 39.7% (-11pp) 5 🟢 15 🔴
Correctness 67.8% (+26pp) 7 🟢 1 🔴
Docs Faithfulness 64.5% (-11pp) 3 🟢 10 🔴
Goal Completion 80.5% (+28.000000000000004pp) 16 🟢 3 🔴
Knowledge Usage 94.9% (+0pp) - -
Tool Usage 68.6% (-2pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 94.7% (-5pp) - 1 🔴
Safety 90.5% (-2pp) 1 🟢 2 🔴
Time_to_first_token 2.5tok (-1.08tok) 28 🟢 1 🔴
Llm_calls 7.17 (+0.21) 16 🟢 8 🔴
Tool_calls 3.14 (-0.07) 12 🟢 12 🔴
Errors 0.05 (-0.05) 3 🟢 1 🔴
Llm_errors 0.02 (-0.02) 3 🟢 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 23160.91tok (-3772.11tok) 12 🟢 14 🔴
Prompt_cached_tokens 7479.91tok (-423.72tok) 14 🟢 11 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 602.53tok (-23.49tok) 16 🟢 13 🔴
Completion_reasoning_tokens 101.28tok (+5.69tok) 12 🟢 15 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23763.44tok (-3795.61tok) 13 🟢 16 🔴
Estimated_cost 0$ (0$) 15 🟢 11 🔴
Duration 15.27s (-3.97s) 25 🟢 4 🔴
Llm_duration 10.15s (-2.06s) 25 🟢 4 🔴

awaseem added a commit that referenced this pull request Aug 6, 2026
The permissions accordion now starts fully collapsed, so the tests expand
the Project category before configuring a permission. The review step also
renders the risk as a badge plus a separate description, which the
assertions now match.

Copying the token needs a real click as well: since #48521 the sheet
wrapper is no longer focusable, so nothing holds focus once the form
unmounts and copyToClipboard bails out on !document.hasFocus().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants