Repository navigation
dialog: Offset a stacked dialog by open dialogs only - #3897
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
huacnlee
reviewed
Nov 11, 2026
huacnlee
left a comment
Member
There was a problem hiding this comment.
✅ Looks good to merge.
crates/component/src/root.rs:266: counting only non-closing dialogs beneath each one (stack_depth) fixes the 16px jump after #3603 kept closing dialogs in the stack.layer_ixstill drives the debug selector and topmost check (dialog.rs:717,781), so those are unaffected.crates/component/src/dialog/dialog.rs:671,692: offset andmax_heightboth usestack_depth, consistent.- Minor note, not blocking: a dialog opened above a closing one now sits at the same offset as the closing one, so for the exit duration the two overlap exactly — that is the intended behaviour here and matches what the test checks.
- Test
a_closing_dialog_does_not_offset_the_next_onecovers both the offset and themax_heightpath. - No public API change (
stack_depthispub(crate)).
Ran: cargo test -p gpui-component --lib dialog (29 passed), cargo clippy -p gpui-component (only a pre-existing unused-dependency warning). CI: green except two GPUI Shell Standard Runtime jobs (Linux/Windows) still pending.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3752.
When a dialog is closed and another one is opened right away, the new dialog appeared 16px lower during the old one's exit animation, then jumped up when the exit ended.
Since #3603, a closing dialog stays in the stack until its exit transition finishes. The stacking offset (
layer_ix * 16), which also reduces the availablemax_height, was computed from the dialog's index in that stack, so it counted the dialog that was leaving.Changes
dialog_layernow also counts the open (not closing) dialogs beneath each dialog, and the offset andmax_heightuse that count.layer_ixstill holds the stack index for the debug selector and the topmost check.Public API
None.
Tests
cargo test -p gpui-component --lib dialog: 29 passed. The newa_closing_dialog_does_not_offset_the_next_onechecks that the second dialog's bounds during the first one's exit equal its bounds after the exit, both for a short body (offset) and a tall one (max_height). It fails without the fix (y 96 vs 80).