Skip to content

fix(sqllab): make dark-theme occurrence highlight readable#42403

Draft
sadpandajoe wants to merge 4 commits into
masterfrom
fix-sqllab-dark-selected-word
Draft

fix(sqllab): make dark-theme occurrence highlight readable#42403
sadpandajoe wants to merge 4 commits into
masterfrom
fix-sqllab-dark-selected-word

Conversation

@sadpandajoe

@sadpandajoe sadpandajoe commented Jul 24, 2026

Copy link
Copy Markdown
Member

SUMMARY

Fixes SQL Lab dark theme so that highlighting a token readably highlights its other occurrences (sc-102561).

Root cause: SQL Lab's Ace editor uses the light github theme, with a token-based dark-mode <Global> CSS override block in AsyncAceEditor/index.tsx. That block overrode .ace_selection etc. but not .ace_selected-word (the marker Ace paints on every other occurrence of the selected token), so it kept the light theme's near-white default and the recolored dark-mode glyphs became unreadable on it. This adds a token-driven .ace_selected-word override (dark-aware colorEditorSelection, falling back to colorPrimaryBgHover, plus colorBorder) carrying !important so it wins over Ace's bundled rule, mirroring the existing aceCompletionHighlightStyles pattern (#41005). The .ace_selection color helper was deduped in the process with no behavior change; light theme is unaffected.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before (master): in dark mode, double-clicking a repeated column name leaves the other occurrences near-invisible.
After (this PR): the other occurrences are highlighted with readable contrast; light theme is unchanged.

Before/after videos: pending capture on the showtime env; will be attached here and on the Shortcut story before this PR leaves draft.

TESTING INSTRUCTIONS

  1. Switch Superset to dark theme and open SQL Lab.
  2. Type a query with a repeated column name, then double-click one occurrence.
  3. The other occurrences are highlighted with readable contrast. Confirm light theme is unchanged.

Unit tests assert the helper emits the dark-aware color, border, and !important, and that the override is wired into the editor's Global styles: AsyncAceEditor.test.tsx.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

The Ace editor uses the light github theme with token-based CSS overrides
for dark mode, but .ace_selected-word (the marker on every other occurrence
of a selected token) was left at the theme default near-white box. In dark
mode the recolored token glyphs became unreadable on it.

Override .ace_selected-word to reuse the dark-aware colorEditorSelection
token, mirroring the existing .ace_selection and completion-highlight
overrides. Light theme is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 5c37d17
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a63e73baf4f9100088f5da4
😎 Deploy Preview https://deploy-preview-42403--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.

@sadpandajoe sadpandajoe added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jul 24, 2026
@github-actions github-actions Bot added 🎪 5c37d17 🚦 building 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 5c37d17

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.25%. Comparing base (206fe7a) to head (206761a).
⚠️ Report is 44 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42403      +/-   ##
==========================================
- Coverage   65.25%   65.25%   -0.01%     
==========================================
  Files        2794     2794              
  Lines      157396   157398       +2     
  Branches    35982    35982              
==========================================
- Hits       102706   102703       -3     
- Misses      52713    52718       +5     
  Partials     1977     1977              
Flag Coverage Δ
javascript 71.23% <100.00%> (-0.01%) ⬇️

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.

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 5c37d17

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

Address review feedback on the dark-theme occurrence-highlight fix:

- Replace the vacuous helper-only assertion with an integration test that
  renders the editor under a distinctive colorEditorSelection and asserts the
  value reaches the injected .ace_selected-word rule. Ace's bundled github
  theme already emits its own near-white .ace_selected-word rule, so a
  selector-only check would pass even if the Global interpolation were dropped;
  tying the assertion to the theme color makes it a real regression guard.
- Assert the concrete colorPrimaryBgHover fallback in the helper test instead
  of re-deriving the value under test.
- Extract a shared editorSelectionColor helper so .ace_selection and
  .ace_selected-word cannot drift apart.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 156aaf3

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 156aaf3

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

The shared `render` helper from `@superset-ui/core/spec` omits `wrapper`
from its options (it always supplies its own SupersetThemeProvider), so
passing a custom `wrapper` tripped TS2353 and failed the lint-frontend
tsc step. Nest the dark theme around the editor element instead; the
innermost emotion ThemeProvider is what the editor's useTheme() resolves,
so the assertion still exercises the dark-aware marker color.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added 🎪 48aba96 🚦 building 🎪 48aba96 📅 2026-07-25T05-07 Environment 48aba96 created at 2026-07-25T05-07 🎪 48aba96 🤡 sadpandajoe Environment 48aba96 requested by sadpandajoe labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 48aba96

@github-actions github-actions Bot added 🎪 48aba96 🚦 deploying 🎪 48aba96 🚦 running Environment 48aba96 status: running 🎪 48aba96 🌐 54.186.2.19:8080 Environment 48aba96 URL: http://54.186.2.19:8080 (click to visit) and removed 🎪 48aba96 🚦 building 🎪 48aba96 🚦 running Environment 48aba96 status: running labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 48aba96

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

@github-actions github-actions Bot added 🎪 206761a 🚦 building Environment 206761a status: building 🎪 206761a 📅 2026-07-25T22-08 Environment 206761a created at 2026-07-25T22-08 🎪 206761a 🤡 sadpandajoe Environment 206761a requested by sadpandajoe labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 206761a

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

Labels

packages size/L 🎪 48aba96 🚦 running Environment 48aba96 status: running 🎪 48aba96 🤡 sadpandajoe Environment 48aba96 requested by sadpandajoe 🎪 48aba96 🌐 54.186.2.19:8080 Environment 48aba96 URL: http://54.186.2.19:8080 (click to visit) 🎪 48aba96 📅 2026-07-25T05-07 Environment 48aba96 created at 2026-07-25T05-07 🎪 ⌛ 48h Environment expires after 48 hours (default) 🎪 206761a 🚦 deploying Environment 206761a status: deploying 🎪 206761a 🤡 sadpandajoe Environment 206761a requested by sadpandajoe 🎪 206761a 📅 2026-07-25T22-08 Environment 206761a created at 2026-07-25T22-08

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant