Skip to content

Update the documentation of Semantics' onLongPress #35112

@kpsroka

Description

@kpsroka

Steps to Reproduce

A working repro is located at https://github.com/kpsroka/flutter_accessibility_demo/tree/onLongPress-Bug (notice the tag)

The core part of the problem is the following:

Semantics(
  label: 'Counter button',
  hint: 'Press to increase',
  value: '$_counter',
  enabled: true,
  container: true,
  excludeSemantics: true,
  onTap: _incrementCounter,
  onLongPress: _decrementCounter,
  child: Text(
    '$_counter',
    style: Theme.of(context).textTheme.display1,
  )),
  1. Launch on an iOS device with VoiceOver enabled, or on an Android device with TalkBack enabled.
  2. Launch the project mentioned above.
  3. Move focus to the counter number. Double-tap to trigger the "tap" handler, double-tap & hold to trigger the "long press" handler.

Observed:

  • onTap handler is being executed, while onLongPress handler isn't.

However, when you enable semantics debugger (uncomment this line), you'll be able to trigger the onLongPress handler.

Logs

flutter run --verbose without SemanticsDebugger

flutter run --verbose with SemanticsDebugger

Notice that I removed the debugPrint statements from the code before executing the above commands.

$ flutter doctor -v
[✓] Flutter (Channel beta, v1.6.3, on Mac OS X 10.14.5 18F132, locale en-PL)
    • Flutter version 1.6.3 at /Users/krzysztofsroka/Library/Flutter
    • Framework revision bc7bc94083 (5 weeks ago), 2019-05-23 10:29:07 -0700
    • Engine revision 8dc3a4cde2
    • Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/krzysztofsroka/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/krzysztofsroka/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[!] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.35.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.1.0

[✓] Connected device (1 available)
    • CK test • 7fd603d4b73339426ca23d745840a51dfcfbaecc • ios • iOS 12.2

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)found in release: 1.21Found to occur in 1.21found in release: 2.9Found to occur in 2.9frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions