Skip to content

fix(sql-lab): fix transparent background in ag-grid native menus - #43368

Draft
sadpandajoe wants to merge 2 commits into
masterfrom
fix-sql-lab-grid-menu-transparent-bg
Draft

fix(sql-lab): fix transparent background in ag-grid native menus#43368
sadpandajoe wants to merge 2 commits into
masterfrom
fix-sql-lab-grid-menu-transparent-bg

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

ThemedAgGridReact (the shared wrapper around AgGridReact used across the app, including SQL Lab's results grid) builds its ag-grid theme via ag-grid v34+'s JS theming API (themeQuartz.withParams(...)). Its base params intentionally set backgroundColor: 'transparent' so the surrounding app surface shows through the grid body, but the params that control the background of ag-grid's own native popups — context/column menus, side bar, tooltips, and loading/no-rows overlays — were either missing entirely or set to a key that isn't a real ag-grid theming param.

Specifically, overlayBackgroundColor was used in the params object, but that key does not exist in ag-grid's theming API at all — I verified this directly against the compiled ag-grid-community runtime bundle (dist/ag-grid-community.js) and its shipped type declarations (core-css.d.ts), not just documentation. The real param is modalOverlayBackgroundColor, whose own default ({ ref: 'backgroundColor', mix: 0.66 }) explains why it fell back to the transparent backgroundColor value — ag-grid silently ignores unrecognized keys rather than erroring, so the typo produced no build or runtime warning.

This PR:

  • Adds the previously-missing chromeBackgroundColor, menuBackgroundColor, sideBarBackgroundColor, and tooltipBackgroundColor params.
  • Fixes overlayBackgroundColor → the real modalOverlayBackgroundColor param.
  • Adds menuBorder: true for readability against the surrounding surface.

All five resolve to theme.colorBgElevated, matching the app's existing elevated-surface color rather than introducing a new one. themeOverrides still merges on top of these per-instance as before, so any caller already setting these explicitly is unaffected.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No screenshot/GIF is included. The affected UI surface — ag-grid's native context/column menu — only renders when an ag-grid Enterprise module (e.g. ContextMenuModule/ColumnMenuModule) is registered on top of ThemedAgGridReact. Vanilla OSS Superset does not register these modules anywhere, so this defect cannot currently be visually reproduced by running OSS Superset alone; it only manifests for downstream consumers that layer licensed ag-grid Enterprise modules onto this shared component. The fix is instead validated at the source/bundle level (see TESTING INSTRUCTIONS) and via a unit test that was confirmed RED before the fix, then GREEN after — including a manual revert-and-recheck to confirm the assertion actually catches the invalid key rather than passing tautologically.

TESTING INSTRUCTIONS

  1. Verify the invalid key directly against the installed package:
    • grep -o "overlayBackgroundColor" node_modules/ag-grid-community/dist/ag-grid-community.js → no matches (key does not exist).
    • grep -o "modalOverlayBackgroundColor" node_modules/ag-grid-community/dist/ag-grid-community.js → present, including in dist/types/src/theming/core/core-css.d.ts.
  2. Run the updated unit test suite:
    • npx jest packages/superset-ui-core/src/components/ThemedAgGridReact/
    • The new test applies non-transparent backgrounds to native menus, tooltips and overlays asserts chromeBackgroundColor, menuBackgroundColor, menuBorder, sideBarBackgroundColor, tooltipBackgroundColor, and modalOverlayBackgroundColor all resolve to the theme's colorBgElevated.
  3. Confirm no regression in the grid's primary SQL Lab consumers: npx jest src/components/GridTable/GridTable.test.tsx src/SqlLab/components/ResultSet/ResultSet.test.tsx.

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

…tooltips

ThemedAgGridReact set backgroundColor to transparent so the surrounding
app shows through the grid body, but never set the separate params
(chromeBackgroundColor, menuBackgroundColor, sideBarBackgroundColor,
tooltipBackgroundColor, modalOverlayBackgroundColor) that control the
background of ag-grid's own context/column menus, side bar, tooltips
and loading/no-rows overlays. Those inherited the transparency too,
making native right-click and column menus unreadable wherever they
render (e.g. the SQL Lab results grid).

Set these params to theme.colorBgElevated and enable menuBorder for
better readability against the surrounding surface, matching the
resolved default background used elsewhere in the app.
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 767b634
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a88d549304b6400086baf42
😎 Deploy Preview https://deploy-preview-43368--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.93%. Comparing base (5812c0e) to head (767b634).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #43368       +/-   ##
===========================================
- Coverage   78.82%   66.93%   -11.89%     
===========================================
  Files        2876     2876               
  Lines      164459   163920      -539     
  Branches    37956    37888       -68     
===========================================
- Hits       129634   109725    -19909     
- Misses      32378    52044    +19666     
+ Partials     2447     2151      -296     
Flag Coverage Δ
javascript 74.21% <ø> (+0.06%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@sadpandajoe sadpandajoe added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Aug 21, 2026
@github-actions github-actions Bot added 🎪 8e51b03 🚦 building Environment 8e51b03 status: building 🎪 8e51b03 📅 2026-08-21T18-26 Environment 8e51b03 created at 2026-08-21T18-26 🎪 8e51b03 🤡 sadpandajoe Environment 8e51b03 requested by sadpandajoe 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Aug 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 8e51b03

@github-actions github-actions Bot added 🎪 8e51b03 🚦 deploying Environment 8e51b03 status: deploying 🎪 8e51b03 🚦 failed Environment 8e51b03 status: failed and removed 🎪 8e51b03 🚦 building Environment 8e51b03 status: building 🎪 8e51b03 🚦 deploying Environment 8e51b03 status: deploying labels Aug 21, 2026
@github-actions github-actions Bot added 🎪 767b634 🚦 building Environment 767b634 status: building 🎪 767b634 📅 2026-08-21T22-47 Environment 767b634 created at 2026-08-21T22-47 🎪 767b634 🤡 sadpandajoe Environment 767b634 requested by sadpandajoe labels Aug 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 767b634

@github-actions github-actions Bot added 🎪 767b634 🚦 deploying Environment 767b634 status: deploying 🎪 767b634 🚦 failed Environment 767b634 status: failed and removed 🎪 767b634 🚦 building Environment 767b634 status: building 🎪 767b634 🚦 deploying Environment 767b634 status: deploying labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages size/M 🎪 8e51b03 🚦 failed Environment 8e51b03 status: failed 🎪 8e51b03 🤡 sadpandajoe Environment 8e51b03 requested by sadpandajoe 🎪 8e51b03 📅 2026-08-21T18-26 Environment 8e51b03 created at 2026-08-21T18-26 🎪 ⌛ 48h Environment expires after 48 hours (default) 🎪 767b634 🚦 failed Environment 767b634 status: failed 🎪 767b634 🤡 sadpandajoe Environment 767b634 requested by sadpandajoe 🎪 767b634 📅 2026-08-21T22-47 Environment 767b634 created at 2026-08-21T22-47

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant