fix(sqllab): Update style for code viewer container#39075
fix(sqllab): Update style for code viewer container#39075justinpark merged 3 commits intoapache:masterfrom
Conversation
Code Review Agent Run #12eff9Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39075 +/- ##
==========================================
- Coverage 64.48% 64.48% -0.01%
==========================================
Files 2536 2536
Lines 130862 130872 +10
Branches 30358 30358
==========================================
+ Hits 84387 84393 +6
- Misses 45012 45016 +4
Partials 1463 1463
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| borderColor: theme.colorBorder, | ||
| borderStyle: 'solid', | ||
| marginTop: theme.sizeUnit * 4, | ||
| fontSize: '0.75em', |
There was a problem hiding this comment.
Could we use this instead? theme.fontSize
| const codeBlockStyle = { | ||
| border: 1, | ||
| borderColor: theme.colorBorder, | ||
| borderStyle: 'solid', |
There was a problem hiding this comment.
Do we need to mention this?
There was a problem hiding this comment.
Yes. Without borderStyle, no border made
| marginTop: theme.sizeUnit * 4, | ||
| fontSize: '0.75em', | ||
| height: 375, | ||
| }; |
There was a problem hiding this comment.
Can we use a more standardized height?
Code Review Agent Run #882634Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@justinpark Can you remove the extra padding between the modal title and the content? I think you just need to remove the content top padding given that the header already has padding. |
| <CodeSyntaxHighlighter language="sql">{sql}</CodeSyntaxHighlighter> | ||
| <div | ||
| css={css` | ||
| margin: -${theme.sizeUnit * 6}px; |
There was a problem hiding this comment.
Suggestion: The new wrapper applies -sizeUnit * 6 margin on all four sides, but the modal body padding is not uniform (sizeUnit * 4 vertical and sizeUnit * 6 horizontal). This overcompensates top/bottom by 8px, which can push content into the header/footer area and cause layout overlap. Use axis-specific negative margins that match the modal body padding. [logic error]
Severity Level: Minor 🧹
- ⚠️ SQL Lab "View SQL" modal has misaligned vertical padding.
- ⚠️ Query history SQL viewer content encroaches modal header spacing.| margin: -${theme.sizeUnit * 6}px; | |
| margin: -${theme.sizeUnit * 4}px -${theme.sizeUnit * 6}px; |
Steps of Reproduction ✅
1. Open SQL Lab (implemented in `superset-frontend/src/SqlLab/components/App/index.tsx`)
and run any query so that results are available; the result view uses `ResultSet`
(`src/SqlLab/components/ResultSet/index.tsx`), which conditionally renders
`HighlightedSql` at lines 584–587 when `showSql` is true.
2. In the SQL Lab "Query history" table (`src/SqlLab/components/QueryTable/index.tsx`),
each row's SQL column is rendered as a `<HighlightedSql>` inside a `Card` at lines 16–23
(offset block 280–319), so clicking that truncated SQL opens a modal via `HighlightedSql`.
3. `HighlightedSql` (`src/SqlLab/components/HighlightedSql/index.tsx`) renders a
`<ModalTrigger>` at lines 112–124 with `modalBody={<HighlightSqlModal rawSql={rawSql}
sql={sql} />}`, and `HighlightSqlModal` returns a wrapper `<div>` with `css={css`margin:
-${theme.sizeUnit * 6}px;`}` at lines 83–88, so this negative margin is applied around the
whole modal body content.
4. The `ModalTrigger` uses the shared `Modal` component from
`packages/superset-ui-core/src/components/Modal/Modal.tsx`, whose `StyledModal` sets
`.ant-modal-body { padding: ${theme.sizeUnit * 4}px ${theme.sizeUnit * 6}px; }` at lines
123–126; combining this with `margin: -${theme.sizeUnit * 6}px;` on the inner `<div>`
cancels left/right padding but overshoots top/bottom by `theme.sizeUnit * 2`, causing the
SQL title and code block to visually encroach into the header/border area instead of
aligning flush only with the horizontal padding as intended. The suggested change to
`margin: -${theme.sizeUnit * 4}px -${theme.sizeUnit * 6}px;` would exactly negate the
modal body padding vertically and horizontally, avoiding this layout mismatch.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
**Line:** 86:86
**Comment:**
*Logic Error: The new wrapper applies `-sizeUnit * 6` margin on all four sides, but the modal body padding is not uniform (`sizeUnit * 4` vertical and `sizeUnit * 6` horizontal). This overcompensates top/bottom by 8px, which can push content into the header/footer area and cause layout overlap. Use axis-specific negative margins that match the modal body padding.
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.
Code Review Agent Run #a1b07eActionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
(cherry picked from commit 4c2dd63)


SUMMARY
Fixes #39076
This commit updates the style for code viewer matching with the previous version.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
Screenshot
ADDITIONAL INFORMATION