Skip to content

Commit

Permalink
Fixed the scroll direction for iOS horizontal accessibility scroll ev…
Browse files Browse the repository at this point in the history
…ents. (#13651)

* Fixed the scroll direction for horizonatal accessibilty scroll events.

* Updated the comment describing the scroll direction mapping.
  • Loading branch information
darrenaustin committed Nov 5, 2019
1 parent 1bfb928 commit 05ab04d
Showing 1 changed file with 7 additions and 5 deletions.
Expand Up @@ -20,18 +20,20 @@

flutter::SemanticsAction GetSemanticsActionForScrollDirection(
UIAccessibilityScrollDirection direction) {
// To describe scroll direction, UIAccessibilityScrollDirection uses the direction the scroll bar
// moves in and SemanticsAction uses the direction the finger moves in. Both move in opposite
// directions, which is why the following maps left to right and vice versa.
// To describe the vertical scroll direction, UIAccessibilityScrollDirection uses the
// direction the scroll bar moves in and SemanticsAction uses the direction the finger
// moves in. However, the horizontal scroll direction matches the SemanticsAction direction.
// That is way the following maps vertical opposite of the SemanticsAction, but the horizontal
// maps directly.
switch (direction) {
case UIAccessibilityScrollDirectionRight:
case UIAccessibilityScrollDirectionPrevious: // TODO(abarth): Support RTL using
// _node.textDirection.
return flutter::SemanticsAction::kScrollLeft;
return flutter::SemanticsAction::kScrollRight;
case UIAccessibilityScrollDirectionLeft:
case UIAccessibilityScrollDirectionNext: // TODO(abarth): Support RTL using
// _node.textDirection.
return flutter::SemanticsAction::kScrollRight;
return flutter::SemanticsAction::kScrollLeft;
case UIAccessibilityScrollDirectionUp:
return flutter::SemanticsAction::kScrollDown;
case UIAccessibilityScrollDirectionDown:
Expand Down

0 comments on commit 05ab04d

Please sign in to comment.