Skip to content

Fix Find and Replace dialogs floating above other apps on macOS#11234

Closed
mjuhasz wants to merge 2 commits into
SubtitleEdit:mainfrom
mjuhasz:fix/find-replace-floating-dialog-macos
Closed

Fix Find and Replace dialogs floating above other apps on macOS#11234
mjuhasz wants to merge 2 commits into
SubtitleEdit:mainfrom
mjuhasz:fix/find-replace-floating-dialog-macos

Conversation

@mjuhasz
Copy link
Copy Markdown
Contributor

@mjuhasz mjuhasz commented May 28, 2026

This change is specific to macOS and aims to align the user experience with the other two supported platforms. I have only tested this on macOS; on Windows and Linux the behavior is unchanged.

Before

Opening the Find or Replace dialog set Topmost=true, which Avalonia maps to NSWindowLevel.Floating on macOS. This caused the dialog to float above every application system-wide — so switching to another app (e.g. a video player or text editor to reference source material) would leave the dialog obstructing that app's window, with no way to dismiss it without returning to Subtitle Edit.

After

The dialog behaves as a proper owned window. It stays above the Subtitle Edit main window but is not modal so you can keep it open while editing the found text, but when you switch to another app it no longer floats on top of it. On Windows and Linux the behavior is unchanged.

On macOS, Avalonia maps Topmost=true to NSWindowLevel.Floating, which
keeps the window above all other applications system-wide. The dialogs
are already owned windows via Show(owner), so on macOS owned windows
naturally stay above their owner without needing Topmost.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the Find and Replace windows on macOS so they don’t behave as “always on top” system-wide, aligning the UX with the intended owned-window behavior while keeping Windows/Linux unchanged.

Changes:

  • Make Find dialog Topmost conditional (false on macOS).
  • Make Replace dialog Topmost conditional (false on macOS).

Comment thread src/ui/Features/Main/MainViewModel.cs
Comment thread src/ui/Features/Main/MainViewModel.cs
After a wrap-around confirmation, restore Topmost to !OperatingSystem.IsMacOS()
instead of unconditionally true, so Find and Replace windows stay non-topmost
on macOS as intended.
@niksedk
Copy link
Copy Markdown
Member

niksedk commented May 29, 2026

A crossplatform fix is hopefully here: #11243

@niksedk niksedk closed this May 29, 2026
pull Bot pushed a commit to A-Archives-and-Forks/subtitleedit that referenced this pull request May 29, 2026
Avoids the Find/Replace dialogs floating above other applications on
macOS, where Avalonia maps Topmost to NSWindowLevel.Floating
process-wide. Topmost is now toggled dynamically based on owner/child
activation, giving the same behavior on Windows, Linux, and macOS
without an OS-specific branch.

Alternative to SubtitleEdit#11234.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mjuhasz
Copy link
Copy Markdown
Contributor Author

mjuhasz commented May 29, 2026

A crossplatform fix is hopefully here: #11243

I tested the macOS cases, it all works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants