Skip to content

[Bug]: Paint events do not fire when window is initially hidden on Windows or Linux #32001

Open

Description

@mitchchn

Preflight Checklist

Electron Version

16.0.0

What operating system are you using?

Other (specify below)

Operating System Version

Windows 11, macOS 12, Fedora 35

What arch are you using?

Other (specify below)

Last Known Working Electron version

11.5.0

Expected Behavior

A hidden window with this configuration should still paint:

  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    show: false,
    paintWhenInitiallyHidden: true,
  })

The page should fire paint events that can be picked up by PerformanceObserver.

const observer = new PerformanceObserver((performance) => {
  console.log("Paint event:", performance.getEntries(), new Date().toString());
});
observer.observe({ entryTypes: ["paint"] });

Actual Behavior

On Windows and Linux, paint events do not fire while the window is hidden. It is unclear whether any painting is happening while the window is hidden.

On macOS, it works as expected.

Windows console output in renderer:

Contentful element added to DOM: <h1>​Paint me!!​</h1>​
Showing window after timeout: Thu Nov 25 2021 13:26:28 GMT-0500 (Eastern Standard Time)
Paint event: Array(2) Thu Nov 25 2021 13:26:28 GMT-0500 (Eastern Standard Time)

Mac console output in renderer:

Contentful element added to DOM: <h1>​Paint me!!​</h1>​
Paint event: Array(2) Thu Nov 25 2021 13:25:10 GMT-0500 (Eastern Standard Time)
Showing window after timeout: Thu Nov 25 2021 13:25:13 GMT-0500 (Eastern Standard Time)

Testcase Gist URL

https://gist.github.com/062c602a24a5f72a1f00d05285fdac68

Additional Information

This behaviour seemed to regress gradually over the course of several Electron versions. In 11.x, the paint events reliably fire when the window is hidden. Around 13-14, they sometimes do, and sometimes do not. As of 16.0, they never fire on Windows or Linux, but continue to fire on macOS.

Activity

  1. added
    has-repro-gist
    on Nov 30, 2021
  2. github-actions commented on Oct 5, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  3. github-actions commented on Nov 6, 2022

    @github-actions
    Contributor

    This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

  4. pushkin- commented on Nov 28, 2022

    @pushkin-

    I think this is still an issue in Electron 21

  5. fanchenio commented on Feb 17, 2023

    @fanchenio

    Indeed, for example, when I want to hide the window, I want to clear the content of the input box on the html, but when the window is hidden, after sending a message to the page through contents.send, it will not take effect immediately, but will take effect after the window is displayed.

  6. github-actions commented on May 19, 2023

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  7. pushkin- commented on May 19, 2023

    @pushkin-

    bump

  8. 30 remaining items

  9. moved this to 👀 Unsorted Items in 35-x-yon Apr 9, 2025
  10. nikwen commented on Apr 10, 2025

    @nikwen
    Member

    I believe this comment explains what broke this in Electron v35 on macOS: #46602 (comment)

  11. added
    status/confirmed
    and removed on Apr 11, 2025
  12. moved this to 👀 Unsorted Items in 36-x-yon Apr 11, 2025
  13. self-assigned this
    on Apr 11, 2025
  14. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 36-x-yon Apr 16, 2025
  15. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 35-x-yon Apr 16, 2025
  16. nikwen commented on Feb 10, 2026

    @nikwen
    Member

    I ran into this while working on #49706.

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

Metadata

Metadata

Assignees

Labels

35-x-y36-x-ybug 🪲has-repro-gistplatform/allstatus/confirmed

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions