Skip to content

Windows: win.focus() results in win.isFocused() to return true even if not #47749

@bpasero

Description

@bpasero

Preflight Checklist

Electron Version

37.2.1

What operating system(s) are you using?

Windows

Operating System Version

Windows 11

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Does the issue also appear in Chromium / Google Chrome?

Yes

Expected Behavior

Calling BrowserWindow.focus() should return false for BrowserWindow.isFocused() if the window actually did not receive focus and is not in foreground.

Actual Behavior

BrowserWindow.isFocused() returns true even if the window is not in foreground and focused after calling BrowserWindow.focus().

Testcase Gist URL

https://gist.github.com/mads6655/b68074cd8e0326a5edc0b2b80ce0b2e8

Additional Information

Run above gist and quickly focus another app, then wait for 5 seconds and observe the console output.

cc @codebytere @deepak1556

Metadata

Metadata

Assignees

Type

Projects

Status

👍 Does Not Block Stable

Status

Follow Up Before Stable

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy