Skip to content

Commit cc6f86e

Browse files
authored
Clarifies semantics long press and semantics on tap documentation (#128599)
fixes flutter/flutter#35112
1 parent a35ae60 commit cc6f86e

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

packages/flutter/lib/src/semantics/semantics.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,18 +1367,29 @@ class SemanticsProperties extends DiagnosticableTree {
13671367
/// the finger without moving it. For example, a button should implement this
13681368
/// action.
13691369
///
1370-
/// VoiceOver users on iOS and TalkBack users on Android can trigger this
1370+
/// VoiceOver users on iOS and TalkBack users on Android *may* trigger this
13711371
/// action by double-tapping the screen while an element is focused.
1372+
///
1373+
/// Note: different OSes or assistive technologies may decide to interpret
1374+
/// user inputs differently. Some may simulate real screen taps, while others
1375+
/// may call semantics tap. One way to handle taps properly is to provide the
1376+
/// same handler to both gesture tap and semantics tap.
13721377
final VoidCallback? onTap;
13731378

13741379
/// The handler for [SemanticsAction.longPress].
13751380
///
13761381
/// This is the semantic equivalent of a user pressing and holding the screen
13771382
/// with the finger for a few seconds without moving it.
13781383
///
1379-
/// VoiceOver users on iOS and TalkBack users on Android can trigger this
1384+
/// VoiceOver users on iOS and TalkBack users on Android *may* trigger this
13801385
/// action by double-tapping the screen without lifting the finger after the
13811386
/// second tap.
1387+
///
1388+
/// Note: different OSes or assistive technologies may decide to interpret
1389+
/// user inputs differently. Some may simulate real long presses, while others
1390+
/// may call semantics long press. One way to handle long press properly is to
1391+
/// provide the same handler to both gesture long press and semantics long
1392+
/// press.
13821393
final VoidCallback? onLongPress;
13831394

13841395
/// The handler for [SemanticsAction.scrollLeft].

packages/flutter/lib/src/widgets/basic.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6983,6 +6983,8 @@ class MetaData extends SingleChildRenderObjectWidget {
69836983
///
69846984
/// See also:
69856985
///
6986+
/// * [SemanticsProperties], which contains a complete documentation for each
6987+
/// of the constructor parameters that belongs to semantics properties.
69866988
/// * [MergeSemantics], which marks a subtree as being a single node for
69876989
/// accessibility purposes.
69886990
/// * [ExcludeSemantics], which excludes a subtree from the semantics tree
@@ -7004,6 +7006,8 @@ class Semantics extends SingleChildRenderObjectWidget {
70047006
///
70057007
/// See also:
70067008
///
7009+
/// * [SemanticsProperties], which contains a complete documentation for each
7010+
/// of the constructor parameters that belongs to semantics properties.
70077011
/// * [SemanticsSortKey] for a class that determines accessibility traversal
70087012
/// order.
70097013
Semantics({

0 commit comments

Comments
 (0)