Fix Find/Replace dialogs stealing focus on app reactivation#11580
Merged
niksedk merged 1 commit intoJun 13, 2026
Merged
Conversation
Replace Activated event with Opened so the Find textbox is focused only when the dialogs first open, not every time the app returns to the foreground.
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.
This PR maintains the smooth flow of opening the Find or Replace dialog, allowing users to type immediately into the Find field. However, it eliminates the unexpected focus shift when switching to another app (e.g., to copy the replacement string), ensuring that pasting does not occur in the search textbox.
Problem
The Find and Replace dialogs subscribed to the
Activatedevent to focus the Find textbox on open.Activatedfires every time the window becomes active — including when the user switches back to the app from another window — so it unconditionally stole focus from whatever control the user had previously clicked (e.g. the Replace textbox, a radio button, or a button).Stealing focus is usually a bad UX pattern. An immediate example I have is that I use Raycast to paste a snippet directly into the active application, for things I don't want to always type, or for characters I can't easily type on a US English layout. But when Raycast switches back to the "active application", Subtitle Edit with its Replace dialog, the focus gets stolen, and the paste goes into the Find field so it's impossible to paste into the Replace field: I have to manually copy the text I want to paste, go again to the Replace field (two keystrokes or a click), and then paste (one more keystroke).
Fix
Replace
ActivatedwithOpenedin bothFindWindowandReplaceWindow.Openedfires exactly once when the window first appears, so the Find textbox gets focus on open as intended, and focus is left alone on subsequentapp activations.
Files changed
src/ui/Features/Edit/Find/FindWindow.cssrc/ui/Features/Edit/Replace/ReplaceWindow.csTesting