reports icon indicating copy to clipboard operation
reports copied to clipboard

FB13416250: Menu bar steals focus from active window when the window is shown in another app's fullscreen space (regression from macOS 13)

Open sindresorhus opened this issue 1 year ago • 1 comments

  • Date: 2023-11-27
  • Resolution: Open
  • Area: Menu Bar
  • OS: macOS 14.1
  • Type: Incorrect/Unexpected Behavior

Description

You have app A in fullscreen mode and and window from app B shown above it in the fullscreen space. The window from app B has focus (key window). If you move your mouse to the top of the screen so that the menu bar (which was hidden) animates in, it will steal focus (key status) from the active window of app B. This is undesirable behavior and causes many problem. This was not the behavior on macOS 13.

I have attached a sample project.

  • Run the sample project
  • Make the window of any app fullscreen (for example, Notes)
  • Click the window of the sample project to make it focused
  • Move the mouse to the top of the screen to reveal the menu bar
  • Notice how the window of our sample project is no longer focused

My specific use-case is that I have a menu bar app (NSStatusBarItem), and when clicked, it opens a window (NSWindow) which is also shown in fullscreen spaces. The window has to be activated when opened. And when it looses its activation, the window closes. However, because the menu bar now steals focus when shown, it means that when the user clicks the menu bar item of my app when in a fullscreen space, it first opens the window of my app, the window tries to activate, but because the mouse is still over the menu bar, the menu bar tries to steal the activation back, which closes the window of my app. Which means, when the user clicks to open the window of my app, it immediately closes again.

Files

Sample project.zip

sindresorhus avatar Nov 27 '23 13:11 sindresorhus

Hey @sindresorhus did you find a solution for this problem?

bruno-ortiz avatar Mar 02 '24 22:03 bruno-ortiz