Skip to content

fix(explore): ensure unsaved-changes dialog renders above View SQL modal v2 - #42546

Merged
rusackas merged 1 commit into
masterfrom
fix/modal-z-index
Jul 29, 2026
Merged

fix(explore): ensure unsaved-changes dialog renders above View SQL modal v2#42546
rusackas merged 1 commit into
masterfrom
fix/modal-z-index

Conversation

@SBIN2010

@SBIN2010 SBIN2010 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Since the z-index of the "View SQL" modal window (1200) was higher than UNSAVED_CHANGES_MODAL_Z_INDEX (1100), this dialog box was overlapped.

fix #42510

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

Снимок экрана от 2026-07-29 00-36-21

AFTER

Снимок экрана от 2026-07-29 00-37-59

TESTING INSTRUCTIONS

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

@dosubot dosubot Bot added the explore:design Related to the Explore UI/UX label Jul 28, 2026
@bito-code-review

bito-code-review Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #6ea649

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: f0799b6..f0799b6
    • superset-frontend/packages/superset-ui-core/src/components/UnsavedChangesModal/index.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

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.25%. Comparing base (22ad3f2) to head (f0799b6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42546      +/-   ##
==========================================
- Coverage   65.25%   65.25%   -0.01%     
==========================================
  Files        2795     2795              
  Lines      157971   157971              
  Branches    36109    36109              
==========================================
- Hits       103083   103082       -1     
- Misses      52893    52894       +1     
  Partials     1995     1995              
Flag Coverage Δ
javascript 71.36% <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.

@SBIN2010
SBIN2010 requested a review from rusackas July 28, 2026 21:39

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for tracking this down, @SBIN2010! Bumping the constant does clear the reported case, but 1200 isn't a fixed ceiling on the View SQL side, it's whatever antd's own auto z-index stacking computes for however many popups happen to be layered at that moment. So the same bug could resurface with a different number down the road.

Left a suggestion on the constant itself: this modal and the View SQL one both render through the same shared <Modal> component, and antd already auto-increments z-index for each newly opened modal off zIndexPopupBase (this codebase already leans on that token elsewhere, e.g. ToastPresenter, SliceHeaderControls) as long as nothing overrides zIndex explicitly. Since the unsaved-changes prompt only ever opens after whatever it's interrupting, dropping the override lets it stack on top naturally, with no magic number to chase again later.

Happy to be wrong here if there was a reason for the hardcoded value in the first place, just wanted to flag it before merging.

Comment on lines 23 to +25
// Ant Design's default modal zIndex is 1000. Using a higher value ensures
// this dialog always renders above other open modals (e.g. a draggable View SQL modal).
const UNSAVED_CHANGES_MODAL_Z_INDEX = 1100;
const UNSAVED_CHANGES_MODAL_Z_INDEX = 1300;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// Ant Design's default modal zIndex is 1000. Using a higher value ensures
// this dialog always renders above other open modals (e.g. a draggable View SQL modal).
const UNSAVED_CHANGES_MODAL_Z_INDEX = 1100;
const UNSAVED_CHANGES_MODAL_Z_INDEX = 1300;
// This modal is always opened on top of whatever it's interrupting, so it
// doesn't need an explicit zIndex: Ant Design auto-increments each newly
// opened modal's z-index off theme.zIndexPopupBase, and this one, opening
// last, naturally lands above everything else already open.
const UNSAVED_CHANGES_MODAL_Z_INDEX = undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feeling like if AntD does automatic z-indexing, we might not need UNSAVED_CHANGES_MODAL_Z_INDEX at all... and can probably remove MORE z-index entries to not have a problem at all. Investigating.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’ll dig into this a bit more, test your suggestion, and get back to you with the results.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Swept the whole frontend for this: UnsavedChangesModal is the only place anywhere that hardcodes a zIndex override on a Modal. Everywhere else either doesn't need one, or already uses the token correctly (PopoverDropdown uses theme.zIndexBase, SliceHeaderControls uses theme.zIndexPopupBase ± 1). The other z-index literals in the codebase are unrelated, local stacking contexts, chart canvases, drag previews, resize handles, nothing competing with the popup system, so no broader sweep needed.

Also checked every caller, the stories file, and the tests: nobody ever passes a custom zIndex to this component. So the fuller fix isn't defaulting the constant to undefined, it's dropping the whole zIndex prop (the type, the default, and the pass-through) and just letting <Modal> render with no override, same as every other modal in the app.

Happy to just push the cleaner version (or open a fresh PR with it) if that's easier than digging back in, no worries either way if you'd rather finish it yourself.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm having an agent look at this ^ a bit more. I would love for your PR to "win" here, but I'm curious if we can sweep the codebase and delete ALL the z-index complexities to just let AntD do what it does naturally, now that we're on V6, so you might see an alternate PR we can assess in parallel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Went ahead and opened the alternate version we talked through: #42548. Dropped UNSAVED_CHANGES_MODAL_Z_INDEX entirely rather than reworking the constant here, so feel free to close this one in favor of that, or let's compare notes if you'd rather keep going on this branch, either is fine by me.

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Meh... this fixes it. I'll see about sweeping up on the other PR I was fiddling around with later.

@rusackas
rusackas merged commit 6852828 into master Jul 29, 2026
78 checks passed
@rusackas
rusackas deleted the fix/modal-z-index branch July 29, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

explore:design Related to the Explore UI/UX packages size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confirm redirect dialog appears behind "View query" modal when opening SQL Lab from Edit Chart

2 participants