Skip to content

Revert: Windows: fix for popup descendent of popup closing the whole tree when the 2nd popup gains focus - #197530

Merged
bkonyi merged 1 commit into
flutter:masterfrom
flutteractionsbot:revert-196911-1795801361
Nov 27, 2026
Merged

bkonyi merged 1 commit into
flutter:masterfrom
flutteractionsbot:revert-196911-1795801361

Conversation

@flutteractionsbot

Copy link
Copy Markdown
Contributor

Reverts: Windows: fix for popup descendent of popup closing the whole tree when the 2nd popup gains focus

Initiated by: @bkonyi

Reason for reverting: failing analysis checks.

Original PR Author: @mattkae

Reviewed By: @robert-ancell

The original PR description is provided below:

What's new?

This fixes a windows bug where a popup tree would erroneously close when a popup of a popup was focused.

fixes #193782

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant in-code documentation (doc comments with ///).
  • If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

…tree when the 2nd popup gains focus (flutter#196911)"

This reverts commit 43150a8.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Nov 27, 2026
@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Nov 27, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes nested popup integration tests and reverts the Win32 popup window activation logic to use GetForegroundWindow() instead of lParam and _WA_INACTIVE. Feedback indicates that reverting this logic re-introduces a known race condition where GetForegroundWindow() may not yet reflect the newly active window, causing the popup to erroneously destroy itself. It is recommended to retain the original deterministic activation logic and instead resolve any analysis failures by adding the missing dart:io import in the test file.

int lParam,
) {
if (message == _WM_ACTIVATE && (wParam & 0xFFFF) == _WA_INACTIVE) {
if (message == _WM_ACTIVATE) {

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.

high

Reverting this change re-introduces a known race condition and reliability issue. During WM_ACTIVATE, GetForegroundWindow() is asynchronous and may not yet reflect the newly active window, which can cause the popup to erroneously destroy itself when it is being activated.\n\nUsing lParam with (wParam & 0xFFFF) == _WA_INACTIVE is the standard, deterministic way to handle this transition in Win32.\n\nIf the original PR failed analysis checks, it was likely due to a missing import 'dart:io'; in dev/integration_tests/windowing_test/test_driver/main_test.dart where Platform.isWindows was used. Please consider fixing the analysis issue (by adding the missing import) rather than reverting this important bug fix.

References
  1. The Flutter Repository Style Guide (Line 27) instructs to check for potential regressions and look for changes that might break existing functionality or introduce unexpected behavior in related areas. (link)

@bkonyi bkonyi added autosubmit Merge PR when tree becomes green via auto submit App emergency Jump the queue; land PR in front of all others; only use for emergencies labels Nov 27, 2026
@flutter-dashboard

Copy link
Copy Markdown

Detected the emergency label.

If you add the autosubmit label, the bot will wait until all presubmits pass but ignore the tree status, allowing fixes for tree breakages while still validating that they don't break any existing presubmits.

The "Merge" button is also unlocked. To bypass presubmits as well as the tree status, press the GitHub "Add to Merge Queue".

@bkonyi
bkonyi added this pull request to the merge queue Nov 27, 2026
Merged via the queue into flutter:master with commit 18fc91c Nov 27, 2026
24 of 25 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 27, 2026
@flutteractionsbot
flutteractionsbot deleted the revert-196911-1795801361 branch November 27, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD emergency Jump the queue; land PR in front of all others; only use for emergencies framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Focusing a nested popup closes both popups and sends the main window behind other applications

2 participants