Skip to content

app.focus() not working #22554

Closed
Closed

Description

@devinfoley

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.

Activity

  1. self-assigned this
    on Mar 6, 2020
  2. codebytere commented on Mar 6, 2020

    @codebytere
    Member

    @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?

  3. MarshallOfSound commented on Mar 9, 2020

    @MarshallOfSound
    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.

  4. mifi commented on May 3, 2020

    @mifi
    Contributor

    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions