Repository navigation
Labels
P2Important issues not at the top of the work lista: desktopRunning on desktopa: multi windowIssues related to multi window supportteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team
Description
This issue occurs on Windows, but not on Linux. I haven't tested on other platforms.
Steps to reproduce
- Create a new Flutter project, paste the code sample below into
main.dart, and run with-d windows - Click to open the first popup, and then click the button to focus it - this works as intended
- Click the button to open the second popup, then click to focus it
Expected results
The popups both remain open, and the main window remains on top.
Actual results
The popups both close, and the window is sent behind other open windows.
Code sample
Code sample
import 'package:flutter/widgets.dart';
import 'package:flutter/src/foundation/_features.dart' as experimental;
import 'package:flutter/src/widgets/_window.dart';
import 'package:flutter/src/widgets/_window_positioner.dart';
void main() {
experimental.isWindowingEnabled = true;
WidgetsFlutterBinding.ensureInitialized();
final window = _RunnerWindow();
final popups = ValueNotifier<List<PopupWindowController>>([]);
void openPopup() {
if (popups.value.length == 2) return;
late final PopupWindowController popup;
popup = PopupWindowController(
// The first popup belongs to the runner window; the second to the first.
parent: popups.value.isEmpty ? window : popups.value.last,
anchorRect: popups.value.isEmpty
? const Rect.fromLTWH(40, 80, 1, 1)
: const Rect.fromLTWH(280, 0, 1, 1),
positioner: const WindowPositioner(
parentAnchor: WindowPositionerAnchor.topLeft,
childAnchor: WindowPositionerAnchor.topLeft,
),
delegate: _PopupDelegate(() {
popups.value = popups.value.where((p) => p != popup).toList();
}),
);
popups.value = [...popups.value, popup];
}
Widget button(String label, VoidCallback onTap) => GestureDetector(
onTap: onTap,
child: Container(
margin: const EdgeInsets.only(top: 12),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: const Color(0xffffffff),
border: Border.all(),
),
child: Text(label),
),
);
Widget popupPanel(
String title,
Color color, {
VoidCallback? openSecond,
}) => Focus(
child: Builder(
builder: (context) => ColoredBox(
color: color,
child: SizedBox(
width: 280,
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(title),
Text(
Focus.of(context).hasFocus
? 'Flutter focus: focused'
: 'Flutter focus: not focused',
),
// Request focus in this popup only when its button is pressed.
button(
'Focus this popup',
() => Focus.of(context).requestFocus(),
),
if (openSecond != null) button('Open second popup', openSecond),
],
),
),
),
),
),
);
runApp(
Directionality(
textDirection: TextDirection.ltr,
child: DefaultTextStyle(
style: const TextStyle(color: Color(0xff000000), fontSize: 18),
child: ValueListenableBuilder(
valueListenable: popups,
builder: (context, controllers, _) => ViewAnchor(
// Each popup renders into its own native view.
view: ViewCollection(
views: [
for (final (index, controller) in controllers.indexed)
PopupWindow(
key: ObjectKey(controller),
controller: controller,
child: popupPanel(
index == 0 ? 'First popup' : 'Second popup',
index == 0
? const Color(0xffc8f2cc)
: const Color(0xffffd0b3),
openSecond: index == 0 ? openPopup : null,
),
),
],
),
child: ColoredBox(
color: const Color(0xffc8e6ff),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text('Main window'),
button('Open first popup', () {
if (popups.value.isEmpty) openPopup();
}),
],
),
),
),
),
),
),
),
);
}
// Only rootView is needed to use the standard runner window as a popup parent.
class _RunnerWindow extends RegularWindowController {
_RunnerWindow() : super.empty() {
rootView = WidgetsBinding.instance.platformDispatcher.implicitView!;
}
@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
class _PopupDelegate extends PopupWindowControllerDelegate {
_PopupDelegate(this.onDestroyed);
final VoidCallback onDestroyed;
@override
void onWindowDestroyed() => onDestroyed();
}
Screenshots or Video
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.47.6, on Microsoft Windows [Version 10.0.26200.9457], locale en-US) [356ms]
• Flutter version 3.47.6 on channel stable at C:\Users\qbgee\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5fc346839b (3 days ago), 2026-09-30 15:02:49 -0700
• Engine revision 692136cb65
• Dart version 3.13.5
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Windows Version (Windows 11 or higher, 25H2, 2009) [1,584ms]
[✗] Android toolchain - develop for Android devices [129ms]
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Chrome - develop for the web [99ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.4.2) [97ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\18\Community
• Visual Studio Community 2026 version 18.4.11620.152
• Windows 10 SDK version 10.0.26100.0
[✓] Connected device (3 available) [136ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.9457]
• Chrome (web) • chrome • web-javascript • Google Chrome 149.0.7827.201
• Edge (web) • edge • web-javascript • Microsoft Edge 154.0.4258.53
[✓] Network resources [183ms]
• All expected network resources are available.
! Doctor found issues in 1 category.Reacted by Matthew Kosarek
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work lista: desktopRunning on desktopa: multi windowIssues related to multi window supportteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

Activity
puneetkukreja98 commentedon Oct 5, 2026
@josh-audio Thanks for reporting it, I was able to reproduce it.
flutter doctor -v:
Windows: fix for popup descendent of popup closing the whole tree whe…
Revert: Windows: fix for popup descendent of popup closing the whole …