Skip to content

onPressed event fires twice when enable RendererBinding.instance.ensureSemantics() for the web #147050

@harismairaj

Description

@harismairaj

Steps to reproduce

  1. Click a button for a long seconds.

Expected results

onPress event should fire one time.

Actual results

onPress event fires twice.
After disable RendererBinding.instance.ensureSemantics(); line it is working fine.

Code sample

Code sample
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const App());
  RendererBinding.instance.ensureSemantics();
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Center(
        child: MaterialButton(
          onPressed: () {
            print("onPressed");
          },
          child: const Text("Button"),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
screen-recorder-fri-apr-19-2024-17-28-59.webm

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.22631.3447], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] 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 2022.2)
[√] VS Code (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)f: gesturesflutter/packages/flutter/gestures repository.found in release: 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22found in release: 3.24Found to occur in 3.24has 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 teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions