Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.focus() not working #22554

Closed
3 tasks done
devinfoley opened this issue Mar 5, 2020 · 3 comments · Fixed by #22612
Closed
3 tasks done

app.focus() not working #22554

devinfoley opened this issue Mar 5, 2020 · 3 comments · Fixed by #22612

Comments

@devinfoley
Copy link
Contributor

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

It would appear that app.focus() stopped working in Electron 6, and remains broken in Electron 8.

  • Electron Version:
    • 8.0.3
  • Operating System:
    • macOS
  • Last Known Working Electron version:
    • 5.0.13

Expected Behavior

app.focus() should bring the application to the foreground.

Actual Behavior

app.focus() does nothing.

To Reproduce

Fiddle: https://gist.github.com/a772265b312329e3f3bc1feb7b6aff7d

  1. Start this fiddle.
  2. As soon as the window pops up, select another application so that Electron is in the background.
  3. Within 5 seconds, the app will attempt to focus itself to no avail.
@codebytere codebytere self-assigned this Mar 6, 2020
@codebytere
Copy link
Member

codebytere commented Mar 6, 2020

@devinfoley this appears to have been intentional: #16400

A potential path forward, however, might be to add an optional force parameter that makes the receiver the active app regardless of whether another app is active.

Thoughts?

@MarshallOfSound
Copy link
Member

The use case here is for things like dragging files from app A to app B. App B needs to be able to focus itself after receiving a file, currently it cant.

@mifi
Copy link
Contributor

mifi commented May 3, 2020

Will this make it into 8.x version?

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

Successfully merging a pull request may close this issue.

4 participants