Skip to content

fix(dashboard): restore top-level tab drop target for dashboards with content#39423

Open
sadpandajoe wants to merge 9 commits intomasterfrom
fix-no-top-level-tab
Open

fix(dashboard): restore top-level tab drop target for dashboards with content#39423
sadpandajoe wants to merge 9 commits intomasterfrom
fix-no-top-level-tab

Conversation

@sadpandajoe
Copy link
Copy Markdown
Member

@sadpandajoe sadpandajoe commented Apr 17, 2026

SUMMARY

PR #37891 moved the DashboardHeader out of the root Droppable in DashboardBuilder.tsx, which left the drop target with zero height when no top-level tabs exist. This made it impossible to drag a "Tabs" component onto dashboards that already have content — the only way to create top-level tabs on an existing dashboard.

The fix adds min-height to .empty-droptarget in StyledHeader, matching the pattern used by DashboardGrid for its empty drop targets.

Root cause: The Droppable renders an empty <div> when no top-level tabs exist. Before #37891, the DashboardHeader was inside it (giving it physical height). After #37891, the header was extracted as a sibling, collapsing the Droppable to zero height — react-dnd cannot detect hover events on a zero-height element.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Dragging a Tabs component from the builder pane onto a dashboard with existing charts shows no drop indicator and the drop does not register.

Screen.Recording.2026-05-01.at.2.48.34.PM.mov

After: The drop target in the header area has 16px min-height, the drop indicator appears, and top-level tabs can be created.

Screen.Recording.2026-05-01.at.2.46.42.PM.mov

TESTING INSTRUCTIONS

  1. Open a dashboard that already has charts/rows (not a blank dashboard)
  2. Enter edit mode
  3. From the "Layout elements" section in the builder pane, drag the "Tabs" component toward the header area (above the existing content)
  4. Verify the blue drop indicator appears and the drop succeeds, creating top-level tabs
  5. Verify blank dashboards still work (drag Tabs onto empty grid)

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@sadpandajoe sadpandajoe added showtime-start 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR and removed showtime-start labels Apr 17, 2026
@github-actions github-actions Bot added 🎪 862b004 🚦 building Environment 862b004 status: building 🎪 862b004 📅 2026-04-17T05-09 Environment 862b004 created at 2026-04-17T05-09 🎪 862b004 🤡 sadpandajoe Environment 862b004 requested by sadpandajoe 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 862b004

@github-actions github-actions Bot added 🎪 862b004 🚦 deploying Environment 862b004 status: deploying 🎪 862b004 🚦 running Environment 862b004 status: running 🎪 🎯 862b004 Active environment pointer - 862b004 is receiving traffic 🎪 862b004 🌐 34.221.68.241:8080 Environment 862b004 URL: http://34.221.68.241:8080 (click to visit) and removed 🎪 862b004 🚦 building Environment 862b004 status: building 🎪 862b004 🚦 deploying Environment 862b004 status: deploying 🎪 862b004 🚦 running Environment 862b004 status: running 🎪 🎯 862b004 Active environment pointer - 862b004 is receiving traffic labels Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 862b004

Environment: http://34.221.68.241:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@github-actions github-actions Bot removed 🎪 862b004 🤡 sadpandajoe Environment 862b004 requested by sadpandajoe 🎪 862b004 📅 2026-04-17T05-09 Environment 862b004 created at 2026-04-17T05-09 🎪 862b004 🚦 running Environment 862b004 status: running 🎪 862b004 🌐 34.221.68.241:8080 Environment 862b004 URL: http://34.221.68.241:8080 (click to visit) labels Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.36%. Comparing base (673634f) to head (d25c075).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39423      +/-   ##
==========================================
- Coverage   64.37%   64.36%   -0.01%     
==========================================
  Files        2569     2569              
  Lines      134745   134745              
  Branches    31278    31278              
==========================================
- Hits        86739    86728      -11     
- Misses      46508    46519      +11     
  Partials     1498     1498              
Flag Coverage Δ
javascript 66.61% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restores a usable top-level tab drop target in dashboards that already have content by ensuring the header-area droppable has non-zero height, preventing react-dnd hover/drop failures after the header/droppable layout change in #37891.

Changes:

  • Add a min-height rule for .empty-droptarget within the dashboard header wrapper styling.
  • Add a Jest test intended to verify the presence of the new styling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx Adds min-height to the header-area empty droptarget so the top-level droppable remains hoverable.
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx Adds a regression test aiming to validate the new header droptarget min-height styling.

@bito-code-review
Copy link
Copy Markdown
Contributor

Yes, the suggestion is valid — it improves test reliability by directly checking the droppable element's class and computed min-height, focusing on actual behavior rather than CSSOM internals.

superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx

const droppable = container.querySelector('[data-test="top-level-tabs"]');
  expect(droppable).toBeInTheDocument();
  expect(droppable).toHaveClass('empty-droptarget');
  const computedStyle = getComputedStyle(droppable);
  expect(computedStyle.minHeight).toBe('16px'); // Adjust based on theme.sizeUnit * 4

…ds with content

PR #37891 moved the DashboardHeader out of the root Droppable, leaving
it with zero height when no top-level tabs exist. This made it impossible
to drag a Tabs component onto dashboards that already have content.

Add min-height to .empty-droptarget in StyledHeader, matching the pattern
used by DashboardGrid for its drop targets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added 🎪 🎯 3fe5902 Active environment pointer - 3fe5902 is receiving traffic 🎪 3fe5902 🚦 running Environment 3fe5902 status: running 🎪 3fe5902 🌐 54.71.224.38:8080 Environment 3fe5902 URL: http://54.71.224.38:8080 (click to visit) and removed 🎪 3fe5902 🚦 running Environment 3fe5902 status: running 🎪 🎯 3fe5902 Active environment pointer - 3fe5902 is receiving traffic labels May 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

🎪 Showtime deployed environment on GHA for 3fe5902

Environment: http://54.71.224.38:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

…on-jest types

- Assert min-height is '16px' (theme.sizeUnit * 4) instead of /\S+/
  to catch zero-height regressions
- Move @emotion/jest type reference from per-file directive to
  src/types/emotion-jest.d.ts for global availability

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🎪 Showtime is building environment on GHA for 93066ad

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🎪 Showtime is building environment on GHA for d25c075

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🎪 Showtime deployed environment on GHA for 93066ad

Environment: http://34.217.75.247:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🎪 Showtime is building environment on GHA for d25c075

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🎪 Showtime deployed environment on GHA for d25c075

Environment: http://52.24.63.201:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🎪 Showtime is building environment on GHA for 7d6513f

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🎪 Showtime deployed environment on GHA for 7d6513f

Environment: http://52.41.2.251:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

Copy link
Copy Markdown
Contributor

@aminghadersohi aminghadersohi left a comment

Choose a reason for hiding this comment

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

Approve — minimal, correct fix with a proper regression test. Two minor nits inline.

* under the License.
*/

/// <reference types="@emotion/jest" />
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.

Nit: this triple-slash directive augments expect globally across all src/ code, not just tests. Harmless in practice since it only adds a type, but the augmentation could live more precisely in spec/helpers/setup.ts (which already does import { matchers } from '@emotion/jest') or via a test-only tsconfig types entry. Not a blocker — putting it in src/types/ is consistent with the existing project convention for ambient declarations.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 6, 2026

Code Review Agent Run #fc1989

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 5bb88b2..7d6513f
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx
    • superset-frontend/src/types/emotion-jest.d.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Use supersetTheme.sizeUnit * 4 instead of hard-coded '16px' so the
test stays in sync with the source rule and resilient to theme
token changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🎪 Showtime is building environment on GHA for b71c556

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🎪 Showtime deployed environment on GHA for b71c556

Environment: http://35.165.228.132:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🎪 Showtime is building environment on GHA for 78fada7

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🎪 Showtime deployed environment on GHA for 78fada7

Environment: http://34.219.244.53:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 7, 2026

Code Review Agent Run #3bfab6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7d6513f..78fada7
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🎪 Showtime is building environment on GHA for ff323ba

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🎪 Showtime deployed environment on GHA for ff323ba

Environment: http://35.161.127.154:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboard:editmode Related to te Dashboard edit mode dashboard:tab Related to the usage of tabs in the Dashboard 🎪 ff323ba 🚦 running Environment ff323ba status: running 🎪 ff323ba 🤡 sadpandajoe Environment ff323ba requested by sadpandajoe 🎪 ff323ba 🌐 35.161.127.154:8080 Environment ff323ba URL: http://35.161.127.154:8080 (click to visit) 🎪 ff323ba 📅 2026-05-07T17-04 Environment ff323ba created at 2026-05-07T17-04 review:draft size/M 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants