Skip to content

CupertinoButton does not handle VoiceOver taps correctly on iOS #170348

Closed

Description

@sonicseaweed

Steps to reproduce

  1. Create a project using flutter create (Flutter version 3.32.2 in my case)
  2. Edit main.dart Change from FloatingActionButton to CupertinoButton, remove tooltip property and import 'package:flutter/cupertino.dart'
  3. Run on iOS device, enable VoiceOver and attempt to click the button with a double tap.

Expected results

I expect the button to be pressed and increment the number as per the default flutter app

Actual results

The button appears to get pressed by a double tap but the onPressed function is never called. A triple tap (long press equivalent) does technically work but is the incorrect way to activate the button.

Code sample

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

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      // This is the default app with the comments removed and the FloatingActionButton replaced with a CupertinoButton
      floatingActionButton: CupertinoButton(
        onPressed: _incrementCounter,
        child: const Icon(Icons.add),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

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.32.2, on macOS 15.5 24F74 darwin-arm64, locale en-US)
[✗] Android toolchain - develop for Android devices
    ✗ 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/macos-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.

[!] Xcode - develop for iOS and macOS (Xcode 16.2)
    ! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.98.2)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for iPhone 14 pro max. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 3 categories.

Activity

  1. sonicseaweed commented on Jun 10, 2025

    @sonicseaweed
    Author

    If I comment out lines 377 and 379 from the cupertino button file https://github.com/flutter/flutter/blob/flutter-3.32-candidate.0/packages/flutter/lib/src/cupertino/button.dart#L377 then it all works as expected, so it may be a clue :)

  2. changed the title [-]CupertinoButton does not handle VoiceOver taps correctly[/-] [+]CupertinoButton does not handle VoiceOver taps correctly on iOS[/+] on Jun 11, 2025
  3. darshankawar commented on Jun 11, 2025

    @darshankawar
    Member

    Thanks for the report. Seeing the same behavior as reported with latest sdk versions.

    stable : 3.32.2
    master : 3.33.0-1.0.pre.444
    
  4. added
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-iosiOS applications specifically
    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)
    and removed
    in triagePresently being triaged by the triage team
    on Jun 11, 2025
  5. chunhtai commented on Jun 11, 2025

    @chunhtai
    Contributor

    This seems like a serious issue, will need more investigation to see what is going on

  6. self-assigned this
    on Jun 11, 2025
  7. added
    P1High-priority issues at the top of the work list
    on Jun 11, 2025
  8. chunhtai commented on Jun 12, 2025

    @chunhtai
    Contributor

    regression cause by #161731
    but this is a bug in rawgesturedetector surfaced by the pr that it sends incorrect tap up event position

  9. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jun 18, 2025
  10. github-actions commented on Jul 2, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)c: regressionIt was better in the past than it is nowfound 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 onp: cupertino_uicupertino_ui package in flutter/packagesplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions