Skip to content

fix: prevent white window flash when Hidden option is true - #4612

Merged
leaanthony merged 2 commits into
v3-alphafrom
fix/4611-hidden-window-flash
Oct 2, 2025
Merged

leaanthony merged 2 commits into
v3-alphafrom
fix/4611-hidden-window-flash

Conversation

@leaanthony

@leaanthony leaanthony commented Sep 29, 2025 •

Copy link
Copy Markdown
Member

Fixes #4611

When creating a window with Hidden: true, the window was briefly visible as a white window before disappearing. This was caused by CreateWindowEx using WS_OVERLAPPEDWINDOW style which includes WS_VISIBLE by default.

The fix excludes WS_VISIBLE from the window style when the Hidden option is set to true, ensuring the window remains invisible until explicitly shown via window.Show().

Summary by CodeRabbit

  • Bug Fixes
    • On Windows, windows created with the Hidden option no longer flash white during creation and now start fully hidden for a smoother launch.
    • Reduces flicker and improves consistency of initial window visibility for hidden windows on Windows.
    • No changes in behavior on macOS or Linux.

Fixes #4611

When creating a window with Hidden: true, the window was briefly
visible as a white window before disappearing. This was caused by
CreateWindowEx using WS_OVERLAPPEDWINDOW style which includes
WS_VISIBLE by default.

The fix excludes WS_VISIBLE from the window style when the Hidden
option is set to true, ensuring the window remains invisible until
explicitly shown via window.Show().
@coderabbitai

coderabbitai Bot commented Sep 29, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The Windows webview window creation now clears the WS_VISIBLE style when options.Hidden is true so the window is created non-visible. No other creation parameters, APIs, or exported declarations were modified.

Changes

Cohort / File(s) Summary
Windows webview window visibility
v3/pkg/application/webview_window_windows.go
When options.Hidden is true, remove WS_VISIBLE from the window style during creation to prevent an initial white flash. No exported/public API changes.
Changelog
v3/UNRELEASED_CHANGELOG.md
Add a Fixed entry describing the bug fix: "Fix the white window appearing on Windows when creating a hidden window" (attribution to @leaanthony and PR #4612).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Application
  participant WV as WebviewWindow
  participant Win as Windows API

  App->>WV: NewWithOptions(options)
  alt options.Hidden == true
    note right of WV #d3f9d8: Clear WS_VISIBLE from window style
  else options.Hidden == false
    note right of WV #f0f0f0: Keep WS_VISIBLE in window style
  end
  WV->>Win: CreateWindowEx(style)
  Win-->>WV: HWND created
  opt Later
    App->>WV: Show()/Hide() as needed
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Bug, v3, size:XS

Poem

I nibble at flags with careful paws,
Clearing a bit so no white light gnaws.
Hidden by default, quiet and neat,
When you call me back, I rise to greet.
A rabbit’s fix—soft, small, and sweet. 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is largely incomplete when compared to the required template. While it includes a clear summary of the change and properly references the issue with "Fixes #4611", it is missing several required sections including Type of change checkboxes, How Has This Been Tested section with platform checkboxes, Test Configuration with wails doctor output, and the complete Checklist section. The description provides good technical context about the problem and solution but fails to address the majority of the template's structural requirements. To bring the PR description into compliance, please add the missing sections from the template: check the "Bug fix" box under Type of change, complete the "How Has This Been Tested?" section with platform testing details (at minimum Windows), provide the output of "wails doctor" under Test Configuration, and complete the Checklist section indicating which items have been addressed (particularly noting the UNRELEASED_CHANGELOG.md update that was made). These sections help reviewers understand the testing scope and ensure quality standards are met.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix: prevent white window flash when Hidden option is true" clearly and concisely describes the main change in the PR. The changeset modifies the Windows webview window creation logic to clear the WS_VISIBLE style when options.Hidden is true, which directly addresses preventing the white window flash mentioned in the title. The title is specific, uses conventional commit formatting, and accurately captures the primary objective of fixing the visual flash issue when creating hidden windows on Windows.
Linked Issues Check ✅ Passed The code changes successfully address the primary objective from issue #4611, which reports that setting Hidden to true causes a white window to briefly appear before disappearing. The fix modifies the Windows webview window creation code to exclude the WS_VISIBLE style when options.Hidden is true, directly preventing the white window flash that was caused by the WS_OVERLAPPEDWINDOW style including WS_VISIBLE by default. This implementation matches the expected behavior that no visible window should appear when Hidden is true, eliminating the need for the workaround of calling window.Show() then window.Hide().
Out of Scope Changes Check ✅ Passed All changes in this pull request are directly related to fixing issue #4611 regarding the white window flash when Hidden is true. The modification to the Windows webview window creation logic (clearing WS_VISIBLE style when options.Hidden is true) is precisely targeted at the reported problem, and the UNRELEASED_CHANGELOG.md entry documents this specific bug fix. There are no code changes that appear unrelated to or outside the scope of addressing the hidden window visibility issue described in the linked issue.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/4611-hidden-window-flash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 29, 2025 •

Copy link
Copy Markdown

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: 927dcce
Status:🚫  Build failed.

View logs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
v3/pkg/application/webview_window_windows.go (1)

371-376: Fix is correct, but clarify the comment.

The bitwise operation correctly clears WS_VISIBLE when options.Hidden is true. However, the comment on line 372 states that WS_OVERLAPPEDWINDOW includes WS_VISIBLE by default, which is technically incorrect. WS_OVERLAPPEDWINDOW is a composite of WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX and does not include WS_VISIBLE. The actual issue is that CreateWindowEx may show windows by default depending on the nCmdShow parameter or system behavior, so explicitly excluding WS_VISIBLE ensures the window starts hidden.

Consider updating the comment for accuracy:

-	// If the window should be hidden initially, exclude WS_VISIBLE from the style
-	// This prevents the white window flash reported in issue #4611
+	// If the window should be hidden initially, ensure WS_VISIBLE is not set
+	// This prevents the window from briefly appearing (white flash) as reported in issue #4611
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f70b9bf and e815f80.

📒 Files selected for processing (1)
  • v3/pkg/application/webview_window_windows.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v3/pkg/application/webview_window_windows.go (1)
v3/pkg/w32/constants.go (1)
  • WS_VISIBLE (345-345)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
v3/pkg/application/webview_window_windows.go (2)

307-307: LGTM! Initialization aligns with visibility fix.

The showRequested flag is correctly initialized based on options.Hidden, ensuring that hidden windows are not automatically shown after navigation completes.


2172-2179: LGTM! Visibility management is consistent with the fix.

The navigationCompleted() method correctly respects options.Hidden by only auto-showing windows when Hidden is false. This works seamlessly with the style fix at line 374-375, ensuring hidden windows remain invisible until explicitly shown via Show().

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Sep 29, 2025
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
v3/UNRELEASED_CHANGELOG.md (1)

26-26: Consider using "flash" for clarity.

The PR title uses "white window flash" which is more precise than "appearing" for describing the brief visual artifact. Consider:

-- Fix the white window appearing on Windows when creating a hidden window by @leaanthony in [#4612](https://github.com/wailsapp/wails/pull/4612)
+- Fix white window flash on Windows when creating a hidden window by @leaanthony in [#4612](https://github.com/wailsapp/wails/pull/4612)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e815f80 and 927dcce.

📒 Files selected for processing (1)
  • v3/UNRELEASED_CHANGELOG.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: Cloudflare Pages

@leaanthony
leaanthony merged commit 4d888a3 into v3-alpha Oct 2, 2025
71 of 73 checks passed
@leaanthony
leaanthony deleted the fix/4611-hidden-window-flash branch October 2, 2025 01:55
Grantmartin2002 pushed a commit to Grantmartin2002/wails that referenced this pull request Apr 29, 2026
…4612)

* fix: prevent white window flash when Hidden option is true

Fixes wailsapp#4611

When creating a window with Hidden: true, the window was briefly
visible as a white window before disappearing. This was caused by
CreateWindowEx using WS_OVERLAPPEDWINDOW style which includes
WS_VISIBLE by default.

The fix excludes WS_VISIBLE from the window style when the Hidden
option is set to true, ensuring the window remains invisible until
explicitly shown via window.Show().

* Update Changelog
@taliesin-ai taliesin-ai added v3 and removed v3-alpha labels Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation v3 Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants