Fix dialogs opening behind undocked video/audio windows (#11971)#11978
Merged
Conversation
When the video controls / audio visualizer are undocked, they float above the main window via WindowService.KeepTopmostWhileOwnerActive (Topmost while the owner is active). Modal dialogs shown through ShowDialogAsync used a plain ShowDialog(owner) with no topmost handling, so they were normal (non-topmost) windows and rendered *behind* the undocked windows. Because a modal dialog is an owned child of the main window, the main window doesn't fire Deactivated, so the undocked window's Topmost is never lowered and the dialog stays hidden (clicking Apply re-asserts the same state). The Find window was unaffected because it already joins the same topmost tier via KeepTopmostWhileOwnerActive. Apply KeepTopmostWhileOwnerActive to dialogs in both ShowDialogAsync overloads so they join that tier: activated last, they sit above the undocked windows, and they still drop below other applications when SE loses focus (the macOS NSWindowLevel.Floating caveat the helper handles). Fixes Settings, Shortcuts, Word lists, Speech to Text and any other ShowDialogAsync dialog at once. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Fixes #11971
Problem
With the video controls / audio visualizer undocked, opening Settings (also Shortcuts, Word lists, Speech to Text) makes the dialog appear behind the undocked Audio visualizer window. The Find dialog is unaffected. Clicking Apply in Settings sends it behind again.
Root cause
Undocked windows float above the main window via
WindowService.KeepTopmostWhileOwnerActive(window, Window!), which setsTopmost = owner.IsActive || child.IsActive. So while the main window is active, they haveTopmost = true.ShowWindowplusKeepTopmostWhileOwnerActive, so it joins the same "topmost-while-active" tier and, activated last, sits on top.ShowDialogAsync→ plainwindow.ShowDialog(owner)with no topmost handling, so they are normal (non-topmost) windows and render beneath theTopmost=trueundocked window.The deferred topmost-recompute doesn't rescue it: a modal dialog is an owned child of the main window, so the main window never fires
Deactivated, the undocked window'sTopmostis never lowered, and the dialog stays hidden. "Apply" re-activates the main window and re-asserts the same state.Fix
Apply
KeepTopmostWhileOwnerActive(window, owner)to dialogs in bothShowDialogAsyncoverloads (WindowsService.cs). The dialog joins the topmost tier — activated last, it sits above the undocked windows — and, unlike a blanketTopmost = true, it still drops below other applications when SE loses focus (the macOSNSWindowLevel.Floatingcaveat the helper was written for). One central change fixes Settings, Shortcuts, Word lists, Speech to Text, and any futureShowDialogAsyncdialog.This also keeps the undocked windows linked/floating with the main app — dialogs now float above them rather than dropping the linkage.
Testing
UI.csproj).🤖 Generated with Claude Code