From 05ab04dbe8cf8ad0e27821abb785ee2655d9af0b Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Tue, 5 Nov 2019 15:25:18 -0800 Subject: [PATCH] Fixed the scroll direction for iOS horizontal accessibility scroll events. (#13651) * Fixed the scroll direction for horizonatal accessibilty scroll events. * Updated the comment describing the scroll direction mapping. --- .../ios/framework/Source/accessibility_bridge.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 36f320d9385..557e5177290 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -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: