Skip to content

MacOS modal focus #18502

@zarubond

Description

@zarubond

On MacOS (Windows/Linux work fine) I am opening a modal window. The modal window opens up fine but focus behavior is broken. When I click on the main window (outside of modal) it gains the focus (which should not happen) and then the modal window gains focus (which is correct), but right after that the modal gains blur (which is wrong). Now if I try to focus the modal with mouse it does not do anything as the main window is focused.

Here I have created a demo which prints out to console which window is focused.
https://github.com/zarubond/electron-quick-start/tree/modal_focus

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    Tested on Electron 3, 5, 6-beta4
  • Operating System:
    MacOS 10.13 (Windows 10 and Ubuntu 18.04 work fine)
  • Last Known Working Electron version:
    None

Expected Behavior

Main window should never get focused if the modal window is opened

Actual Behavior

Main window gains focused event if the modal window is opened.

To Reproduce

Open up the console to see which windows are getting focused and the open the modal with open button.

https://github.com/zarubond/electron-quick-start/tree/modal_focus

Screenshots

image
(ignore the last line, I had to switch to screen-short program)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions