Skip to content

Semantics: custom accessibility actions, onIncrease/onDecrease and onDismiss #110

Backlog

Description

@tayormi

Select your plan

Standard - priority support

Confirmations

  • I searched the existing feature requests and this is not a duplicate.

Framework or plugin?

Framework

Platform

Both

Use case

Thanks for adding Semantics in #63. The remaining gap is actions beyond tap and long press. Semantics takes flags, label, identifier, value, hint, onTapHint, onLongPressHint, onTap and onLongPress (lib/src/widgets/semantics.dart), so a control whose main gesture is a drag or a swipe has no VoiceOver or TalkBack path:

  • a list the user reorders by dragging (move up / move down),
  • a row the user swipes to delete,
  • a value the user adjusts (VoiceOver's swipe up and down on an adjustable element).

Our workaround is a separate visible Edit mode with Move up, Move down and Remove buttons, which VoiceOver can reach, but it is extra UI that sighted users also have to learn. (ReorderableListView and Dismissible exist now; their docs don't mention an accessibility path, and they would be the first users of these actions.)

Proposal

Add to Semantics, as in Flutter:

Semantics(
  label: 'Stop 12',
  customSemanticsActions: {
    const CustomSemanticsAction(label: 'Move up'): () => move(i, i - 1),
    const CustomSemanticsAction(label: 'Move down'): () => move(i, i + 1),
    const CustomSemanticsAction(label: 'Delete'): () => remove(i),
  },
  onIncrease: () => setState(() => value++),
  onDecrease: () => setState(() => value--),
  onDismiss: close,
  child: row,
)
  • customSemanticsActions maps to accessibilityCustomActions (UIAccessibilityCustomAction) on iOS and AccessibilityActions on Android.
  • onIncrease / onDecrease set the adjustable trait and map to accessibilityIncrement / accessibilityDecrement (iOS) and scroll forward / backward (Android).
  • onDismiss maps to accessibilityPerformEscape (iOS) and the dismiss action (Android).

ReorderableListView and Dismissible could then expose default actions (move up / move down, delete), as Flutter's do.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions