Skip to content

The showDialog bug prevents Flutter from being applied to production-level web applications. #173356

@332lfgb6

Description

@332lfgb6

Steps to reproduce

  1. Jump from the home page to the detail page
  2. Open the dialog on the detail page.
  3. Click the back button that comes with the Edge Mobile browser.

Expected results

The dialog will close, and the page will remain on the detail page, with the URL being "/detail"
or
The dialog will close, and the page will return to the home page, with the URL being "/"

Actual results

The dialog will close, and the page will remain on the detail page, But the URL is /

Code sample

part1

routes:  {
  '/': (context) => const HomePage(),
  '/detail': (context) => const DetailPage(),
},

part2

onTap: () {
  showDialog(
    context: context,
    builder:
        (ctx) => AlertDialog(
      title: const Text('Invalid Input'),
      content: const Text('Please enter all the fields'),
      actions: [
        TextButton(
          onPressed: () => Navigator.pop(ctx),
          child: const Text('Okay'),
        ),
      ],
    ),
  );

Do not click the "OK" button. Instead, click the back button built into the Edge browser (since you cannot prevent users from doing so). Clicking the "OK" button is normal. Only by clicking the back button provided by the browser can this bug be reproduced.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

[√] Flutter (Channel stable, 3.32.8, on Microsoft Windows [版本 10.0.19045.6093], locale zh-CN)
[√] Windows Version (10 专业版 64 位, 22H2, 2009)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
[√] IntelliJ IDEA Ultimate Edition (version 2025.1)
[√] Connected device (4 available)
[√] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.f: routesNavigator, Router, and related APIs.found in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions