Repository navigation
dialog: Animate the exit to match the entrance - #3603
Merged
Merged
Conversation
YidaWeng
force-pushed
the
fix/dialog-exit-animation
branch
from
October 19, 2026 13:20
21ae0f0 to
197915c
Compare
Contributor
Author
|
CI note: the red |
A closed dialog was removed in the same frame, so every DialogEntrance played on the way in and vanished on the way out. Closing now retains the dialog until a Presence transition sampled from the entrance state runs back to zero, keyed by a stable per-dialog id. A closing dialog accepts no Escape, backdrop press, confirm, or cancel, stops counting as an active dialog, and releases pointer input: its dim fades with the layer but no longer routes presses to the backdrop. The overlay hands over to the next open dialog without a flash, stacked dialogs keep the lower one mounted, and reopening during an exit gets a fresh transition. Reduced motion, DialogEntrance::None, and a zero theme duration still close in a single frame. The base host paints its popup in a deferred pass, where opacity on the layer no longer applies. The surface now carries the fade itself for the exit and for the documented Fade/FadeSlide entrance.
YidaWeng
force-pushed
the
fix/dialog-exit-animation
branch
from
October 20, 2026 04:26
197915c to
7a0e6bb
Compare
Share entrance and exit progress, retain stable dialog subtree identities, and block interaction with exiting content. Add interruption, reopening, and input regressions. AI-assisted implementation and regression tests.
huacnlee
enabled auto-merge (squash)
October 20, 2026 13:18
huacnlee
previously approved these changes
Oct 20, 2026
Non-motion Kit tests relied on incidental entrance progress and the previous numeric surface ID. Use reduced motion and the stable surface ID while retaining every assertion. AI-assisted test updates, validated with the full Kit test suites on GPUI and GPUI Fast.
feigeCode
added a commit
to feigeCode/gpui-kit
that referenced
this pull request
Oct 27, 2026
对话框层自 longbridge#3603 起带 Presence 进出场动画,render_dialog_layer 只能在 渲染期(prepaint/paint)调用。为宿主与测试提供只读查询函数 active_dialog_count(window, cx),返回活动对话框数(含退出动画中), 避免在非渲染期触碰渲染期 API。
madcodelife
added a commit
that referenced
this pull request
Nov 11, 2026
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 available `max_height`, was computed from the dialog's index in that stack, so it counted the dialog that was leaving. ## Changes - `dialog_layer` now also counts the open (not closing) dialogs beneath each dialog, and the offset and `max_height` use that count. - `layer_ix` still 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 new `a_closing_dialog_does_not_offset_the_next_one` checks 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). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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 #3553
Description
DialogEntranceanimated the dialog in, butclose_dialog_internalremoved it from the dialog stack in the same frame, so the surface, shadow, and backdrop cut away instead of leaving. Closing now keeps the dialog mounted until its exit transition finishes.SlideDownreturns to the top andFadeSlidereverses its travel, while the surface and dim fade out together.Fadefades at its final position.has_active_dialogonly counts dialogs that are still open. Pointer input is released as soon as the close begins, so the application beneath is usable again; the popup keeps shielding its own surface until it unmounts.DialogEntrance::None, and a zero theme duration still close in a single frame, preserving the previous synchronous contract.defer_close_dialog's focus restoration still compares open-dialog counts, so dialog: Preserve focus across menu actions and delayed restoration #3453's focus behavior is unchanged.The base dialog host paints its popup in a deferred pass, where opacity applied to the layer no longer reaches it. The fade is therefore applied to the surface itself. That also makes the documented
Fade/FadeSlideentrance fade visible, which the previous layer opacity never did; the entrance timing and motion are otherwise unchanged.Screenshot
Not applicable: this is a time-based transition. The tests step the animation clock and assert the intermediate surface position, opacity, and unmount.
How to Test
cargo test -p gpui-component --lib— 701 passed.cargo test -p gpui-kit --test integration --features "test-support,component"— 402 passed.cargo test -p gpui-shell --test integration— 121 passed.cargo clippy -p gpui-component --all-targets -- -D warnings— clean. On the local nightly the pre-existingunnecessary_as_slicelint insearchable_list/vec.rswas allowed for this run; it is unrelated to this change.cargo check -p gpui-component-story.New tests cover the reverse trajectory and unmount, surface fading mid-exit, single-frame closing for reduced motion and zero durations, stacked retention, click-through to the app beneath, and reopening during an exit. Website docs are updated in English and Chinese.
Checklist
cargo runfor story tests related to the changes.