Is there any way to prevent the context menu from stealing focus from the active window? It causes the copy function to fail in some interfaces—once the interface loses focus, the text selection is lost.
Do you mean the actual window focus (i.e. do the window buttons turn gray if you open the menu)?
The keyboard focus needs to switch because otherwise you couldn't control the context menu via keyboard. However the assigned actions are only executed once the context menu closes, so the keyboard focus should be back to the previous window then.
That's right—this causes certain apps, like ChatWise, to lose the text-selection state, because the focus has to jump back to the input field. A Floating Menu can work around it, but a Floating Menu is even less convenient to set up.
unfortunately I don't think there is a way to resolve this, system context menus always capture keyboard focus. However if the apps implement the standard system API's the keyboard focus will automatically return to what it was before the context menu took the focus.
Unfortunately that only works for custom windows like the floating menu, for the context menus BTT uses the macOS default ones (on older macOS versions it was possible to keep keyboard focus on the other app, but with macOS 14 the behavior of the context menus changed)
No wonder I remember it didn’t use to activate. Thanks for the answer.
I haven't observed any selection loss in the apps I use though. Is this something specific to ChatWise or did you see this somewhere else as well?
(e.g. I have some custom context menus that use the "Transform Selected Text With Java Script" action and haven't encountered any issues with that)
It mainly happens in some AI chat apps—for example, in the official ChatGPT—where there’s still a chance the text can’t be selected when it comes back.
