Skip to content

fix(view query): Update style for code viewer container#39635

Merged
rusackas merged 1 commit into
apache:masterfrom
justinpark:fix--view-query-modal-styling
May 21, 2026
Merged

fix(view query): Update style for code viewer container#39635
rusackas merged 1 commit into
apache:masterfrom
justinpark:fix--view-query-modal-styling

Conversation

@justinpark
Copy link
Copy Markdown
Member

SUMMARY

Following up #39075, this commit updates additional styling for sql code viewers

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before after
Screenshot_2026-04-24_at_12_20_36 PM Screenshot_2026-04-24_at_12_29_24 PM
Screenshot_2026-04-24_at_12_33_47 PM Screenshot_2026-04-24_at_12_33_29 PM

TESTING INSTRUCTIONS

Check stying for view query modal

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

Co-authored-by: Copilot <copilot@github.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 24, 2026

Code Review Agent Run #e81fe5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: f4b361a..f4b361a
    • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
    • superset-frontend/src/explore/components/controls/ViewQuery.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

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Apr 24, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit f4b361a
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69ebc6af75940f000835f46e
😎 Deploy Preview https://deploy-preview-39635--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

flex: 1,
marginBottom: theme.sizeUnit * 3,
fontSize: theme.fontSize * 0.75,
padding: 0,
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.

Suggestion: Removing all syntax block padding causes the absolutely positioned copy button to overlap the rendered SQL text, which can hide the beginning of lines and interfere with text readability/click selection. Keep top/right padding (or add explicit right padding) to reserve space for the overlay button. [possible bug]

Severity Level: Major ⚠️
- ❌ ViewQuery modal copy button overlaps SQL content.
- ⚠️ SQL text partially obscured, harder to read.
- ⚠️ Text selection interfered near top-right code area.
- ⚠️ Affects Explore and Dashboard view-query flows.
Steps of Reproduction ✅
1. From the Explore UI, open the "View query" modal via the "View query" menu option,
wired in `src/explore/components/useExploreAdditionalActionsMenu/index.tsx:5–25` where
`ModalTrigger` renders `<ViewQueryModal latestQueryFormData={latestQueryFormData as
QueryFormData} />` as its `modalBody`.

2. `ViewQueryModal` (`src/explore/components/controls/ViewQueryModal.tsx:44–49, 91–108`)
maps the backend `result` array and, for each `item.query`, renders the `ViewQuery`
component, so any SQL query displayed in this modal goes through `ViewQuery`.

3. In `ViewQuery` (`src/explore/components/controls/ViewQuery.tsx:160–177`), the SQL is
rendered with `<StyledThemedSyntaxHighlighter language={language} customStyle={{ flex: 1,
marginBottom: theme.sizeUnit * 3, fontSize: theme.fontSize * 0.75, padding: 0, }}>`, where
the `padding: 0` line at 172 overrides the default padding of `CodeSyntaxHighlighter`.

4. The `CodeSyntaxHighlighter` implementation
(`packages/superset-ui-core/src/components/CodeSyntaxHighlighter/index.tsx:121–127,
129–160, 185–201`) builds `defaultCustomStyle` with `padding: theme.sizeUnit * 4` but then
spreads `customStyle` last (line 126), so `padding: 0` removes all top/right padding. The
component also renders an internal copy button absolutely positioned at the top-right
(`position: absolute; top: ${theme.sizeUnit}px; right: ${theme.sizeUnit}px;` with its own
padding, lines 129–152). With no padding on the code block, the first lines of SQL extend
fully into the top-right corner under this absolute button, causing the overlay copy
control to sit on top of the rendered SQL text and interfere with readability and mouse
selection in both Explore and Dashboard "View query" modals (Dashboard wiring via
`src/dashboard/components/SliceHeaderControls/index.tsx:7–23`).

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/components/controls/ViewQuery.tsx
**Line:** 172:172
**Comment:**
	*Possible Bug: Removing all syntax block padding causes the absolutely positioned copy button to overlap the rendered SQL text, which can hide the beginning of lines and interfere with text readability/click selection. Keep top/right padding (or add explicit right padding) to reserve space for the overlay button.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.52%. Comparing base (8ce2343) to head (f4b361a).
⚠️ Report is 116 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39635   +/-   ##
=======================================
  Coverage   64.51%   64.52%           
=======================================
  Files        2557     2557           
  Lines      133049   133053    +4     
  Branches    30901    30901           
=======================================
+ Hits        85843    85847    +4     
  Misses      45716    45716           
  Partials     1490     1490           
Flag Coverage Δ
javascript 66.34% <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 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

@jaymasiwal jaymasiwal left a comment

Choose a reason for hiding this comment

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

Great catch by the bot on the overlap issue. Instead of padding: 0, should we use something like padding: theme.sizeUnit * 2 or paddingRight: theme.sizeUnit * 10? This would keep the text clear of the absolute positioned copy button.

Also, for the font size, theme.fontSize * 0.75 (~10.5px) might be a bit too small for readability. Would it be better to use a standard token like theme.typography.sizes.s (12px) to stay consistent with other SQL viewers in the app?

Lastly, curious about the -8 * theme.sizeUnit margin in HighlightedSql. Is that to offset a specific parent container's padding, or could we achieve the same look by adjusting the StyledTabs header directly?

@michael-s-molina michael-s-molina moved this from Done to In Progress in Superset 6.1.0 Release Bugs Apr 28, 2026
@michael-s-molina michael-s-molina moved this from In Progress to Non-blockers in Superset 6.1.0 Release Bugs Apr 29, 2026
Copy link
Copy Markdown
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM... though the sizeUnit * 26 height seems a bit... specific. Should we do something based on modal/viewport height?

@rusackas
Copy link
Copy Markdown
Member

@justinpark should we merge this or do you wanna make the number less "magic"?

@rusackas rusackas merged commit b8b9157 into apache:master May 21, 2026
75 of 76 checks passed
sha174n pushed a commit to sha174n/superset that referenced this pull request May 22, 2026
kasiazjc pushed a commit that referenced this pull request May 26, 2026
Co-authored-by: Copilot <copilot@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/S

Projects

Status: Non-blockers

Development

Successfully merging this pull request may close these issues.

4 participants