Fixed the scroll direction for iOS horizontal accessibility scroll events. (flutter/engine#13651)

* Fixed the scroll direction for horizonatal accessibilty scroll events.

* Updated the comment describing the scroll direction mapping.
This commit is contained in:
Darren Austin
2019-11-05 15:25:18 -08:00
committed by GitHub
parent a1824112a4
commit b9c225a35d

View File

@@ -20,18 +20,20 @@ constexpr int32_t kRootNodeId = 0;
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: