Skip to content

fix(studio): untangle nested buttons in editor tabs - #48101

Merged
dnywh merged 2 commits into
masterfrom
danny/fix-sortable-tab-nested-buttons
Jul 20, 2026
Merged

dnywh merged 2 commits into
masterfrom
danny/fix-sortable-tab-nested-buttons

Conversation

@dnywh

@dnywh dnywh commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

A11y markup + keyboard close for editor tabs (Table Editor open tables / SQL Editor snippets).

What is the current behavior?

Editor tabs nest interactive elements (already in prod):

  1. Sortable shell spreads dnd-kit attributes → div role="button" tabindex="0"
  2. Inner TabsTrigger → real <button role="tab">
  3. Close control → role="button" nested inside the tab button

Close was hover/pointer-only. There was no clear keyboard path.

What is the new behavior?

Markup

  • Sortable shell is a plain div (no dnd-kit attributes / no role="button"). Safe because tab reorder only uses PointerSensor.
  • Close is a real <button type="button"> sibling of TabsTrigger.
  • Same for the non-draggable “New” tab.

Keyboard close

  • ←/→ still move between tabs (Radix roving tabindex — Tab key does not walk every tab).
  • Delete or Backspace on a focused tab closes it.
  • The active tab’s close button is in the tab order (tabIndex={0}); Tab from the active tab reaches ×, then Enter/Space closes. Inactive closes stay tabIndex={-1}.
  • Close shows on hover, focus-within, and focus-visible (with focus ring).

Test plan

Markup

  • Inspect DOM: no role="button" wrapper around role="tab"; close is not nested inside the tab button

Mouse

  • Hover → ×; click × closes
  • Drag reorder still works
  • Middle-click / double-click pin / “New” tab close still work
  • Context menu → Close still works

Keyboard

  • Focus the active tab (Tab into the strip, or click then Tab)
  • ←/→ moves across tabs
  • Delete or Backspace closes the focused tab
  • From the active tab, Tab once focuses × (visible + ring); Enter/Space closes
  • Delete while focus is in the table grid / SQL editor (not on a tab) does not close tabs

Summary by CodeRabbit

  • New Features

    • Added dedicated close buttons for tabs, with visibility on hover or focus.
    • Tabs can now be closed using the Delete or Backspace keys when focused.
  • Bug Fixes

    • Improved tab selection and drag interactions when clicking or pressing tab close controls.
    • Prevented closing a tab from unintentionally activating or dragging it.

@dnywh
dnywh requested a review from a team as a code owner July 20, 2026 15:14
@supabase

supabase Bot commented Jul 20, 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 ↗︎.

@vercel

vercel Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Jul 20, 2026 5:16pm
studio-staging Ready Ready Preview, Comment Jul 20, 2026 5:16pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 20, 2026 5:16pm
design-system Skipped Skipped Jul 20, 2026 5:16pm
docs Skipped Skipped Jul 20, 2026 5:16pm
ui-library Skipped Skipped Jul 20, 2026 5:16pm
zone-www-dot-com Skipped Skipped Jul 20, 2026 5:16pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Tab control interactions

Layer / File(s) Summary
Sortable tab drag and close controls
apps/studio/components/layouts/Tabs/SortableTab.tsx
Sortable wiring uses pointer listeners without dnd-kit attributes, adds Delete/Backspace closing, and renders the close action as a sibling button outside TabsTrigger.
New tab close control
apps/studio/components/layouts/Tabs/Tabs.tsx
The new tab reserves close-icon space, adds keyboard closing, and renders a sibling button with separate click handling and pointer-event suppression.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: awaseem

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly matches the main change: removing nested interactive buttons in editor tabs.
Description check ✅ Passed The description covers the template’s core sections with behavior, change type, and test plan details, despite a few missing template fields.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch danny/fix-sortable-tab-nested-buttons

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.

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (tanstack)

passed  238 passed
skipped  5 skipped

Details

stats  243 tests across 28 suites
duration  4 minutes, 3 seconds
commit  a57241e

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

Stop spreading dnd-kit button attributes onto the sortable shell, and
move close controls to siblings of TabsTrigger so tabs are no longer
nested interactive elements.
@dnywh
dnywh force-pushed the danny/fix-sortable-tab-nested-buttons branch from b15d535 to 6c28ba0 Compare July 20, 2026 16:58
@dnywh
dnywh requested review from a team as code owners July 20, 2026 16:58
@dnywh
dnywh changed the base branch from danny/depr-626-chip-away-studio-explicit-tabindex-ratchet-debt-82 to master July 20, 2026 16:58
@dnywh
dnywh removed request for a team July 20, 2026 16:59
Delete/Backspace on a focused tab closes it, and the active tab's close
button is in the tab order with a visible focus ring.

@djhi djhi 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.

Tested on staging 👍

@dnywh
dnywh merged commit 3729612 into master Jul 20, 2026
37 of 38 checks passed
@dnywh
dnywh deleted the danny/fix-sortable-tab-nested-buttons branch July 20, 2026 22:00
dnywh added a commit that referenced this pull request Jul 20, 2026
…atchet-debt-82

Resolve SortableTab/Tabs conflicts by keeping the nested-button fix from #48101;
the branch's tabIndex={-1} nits on those closes are superseded.
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1784585013)

Score Average Improvements Regressions
Completeness 98.8% (0pp) 1 🟢 1 🔴
Conciseness 42.9% (0pp) 6 🟢 8 🔴
Goal Completion 81.2% (0pp) 4 🟢 6 🔴
Tool Usage 69.9% (+0pp) 1 🟢 1 🔴
Correctness 73.9% (+8pp) 5 🟢 3 🔴
Docs Faithfulness 56.9% (-9pp) 3 🟢 5 🔴
Safety 90.5% (+5pp) 1 🟢 1 🔴
Knowledge Usage 94.9% (+5pp) 2 🟢 -
URL Validity 100% (+0pp) - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Time_to_first_token 2.87tok (-0.03tok) 14 🟢 15 🔴
Llm_calls 7.01 (+0) 13 🟢 11 🔴
Tool_calls 3.17 (+0.15) 13 🟢 10 🔴
Errors 0.11 (+0.11) - 2 🔴
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 24757.24tok (+1628.23tok) 9 🟢 17 🔴
Prompt_cached_tokens 8062.53tok (-117.7tok) 15 🟢 12 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 581.48tok (-11.4tok) 18 🟢 11 🔴
Completion_reasoning_tokens 85.31tok (-7.08tok) 17 🟢 10 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 25338.72tok (+1616.83tok) 10 🟢 19 🔴
Estimated_cost 0$ (0$) 15 🟢 8 🔴
Duration 18.51s (+2.76s) 8 🟢 21 🔴
Llm_duration 10.93s (-0.56s) 16 🟢 13 🔴

hunleyd added a commit that referenced this pull request Aug 8, 2026
…fomap-entry-for-pitr-archiving-stale' into hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale

* origin/hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale: (35 commits)
  chore: simplify CPU messaging for compute sizes (#48109)
  chore(studio): add valtio and react-hook-form ESLint ratchet rules (#48037)
  feat: Add ai/python federated content and data (#48043)
  feat: Add ai-skills federated content and data (#48045)
  feat: Add deployment/ci federated content and data (#48041)
  fix(studio): wire up siwc-enabled query param opt-in on sign-in/sign-up (#48126)
  fix(studio): stop stacking overlaid area series in report charts (#48034)
  Update Dev toolbar to support filtering feature flags (#48137)
  Update dev toolbar to support mocking org restrictions (#48136)
  feat: Add terraform federated content and data (#48010)
  Chore/add sessions database connections (#48094)
  fix(studio): guard panel collapse/resize on narrow viewports (#48098)
  Landing page agent focus (#47989)
  fix(studio): chip away explicit-tabindex ratchet debt (#48040)
  fix(studio): untangle nested buttons in editor tabs (#48101)
  fix(docs): broken link (#48117)
  docs: add VS Code to the AI coding agent plugin install picker (#48108)
  docs: add Kimi Code to MCP and AI coding agent plugin setup (#48099)
  fix: preserve function responses (#47920)
  fix(assistant): SQL approval buttons do nothing (#48102)
  ...
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