Skip to content

Conversation

@KanishkRanjan
Copy link

@KanishkRanjan KanishkRanjan commented Jan 6, 2026

Description of Change

Fixes #43531

Feat: add paintWhenInitiallyHidden option to WebContentsView

This PR adds a paintWhenInitiallyHidden option to the WebContentsView constructor.

Setting this flag to true ( which is default ) "wakes up" the renderer so it can fire ready-to-show and correctly set its initial visibilityState to hidden while still in the background.

⚠️ This PR introduces a breaking change ⚠️.

Checklist

Release Notes

Notes: Added the paintWhenInitiallyHidden option to the WebContentsView constructor to allow background painting and initialization.

@welcome
Copy link

welcome bot commented Jan 6, 2026

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jan 6, 2026
Copy link
Member

@nikwen nikwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

I'll let someone else look at the C++ code who is more familiar with it.

const w = new BaseWindow({ show: true });
w.setContentView(v2);
const state2 = await v2.webContents.executeJavaScript('document.visibilityState');
expect(state2).to.equal('visible');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two separate tests should be two separate it() calls.

@KanishkRanjan KanishkRanjan requested a review from a team as a code owner January 7, 2026 18:42
@KanishkRanjan KanishkRanjan requested a review from nikwen January 7, 2026 19:07
@nikwen nikwen added the semver/major incompatible API changes label Jan 12, 2026
@KanishkRanjan KanishkRanjan changed the title feat: ready-to-show event on webContents feat: ready-to-show event on webContents Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/requested 🗳 new-pr 🌱 PR opened recently semver/major incompatible API changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: ready-to-show event on webContents

2 participants