diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm index 2fe38516f4f5f..8212c2fd01f72 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm @@ -692,6 +692,13 @@ - (BOOL)accessibilityActivate { return NO; } if (!self.node.HasAction(flutter::SemanticsAction::kTap)) { + // Prevent sliders to receive a regular tap which will change the value. + // + // This is needed because it causes slider to select to middle if it + // does not have a semantics tap. + if (self.node.HasFlag(flutter::SemanticsFlags::kIsSlider)) { + return YES; + } return NO; } self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kTap); diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm index d0fcaeab2bb31..ff514b6730057 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm @@ -1206,4 +1206,18 @@ - (void)testUIFocusItemContainerConformance { XCTAssertTrue([itemsInRect containsObject:child1]); XCTAssertTrue([itemsInRect containsObject:child2]); } + +- (void)testSliderSemanticsObject { + fml::WeakPtrFactory factory( + new flutter::testing::MockAccessibilityBridge()); + fml::WeakPtr bridge = factory.GetWeakPtr(); + + flutter::SemanticsNode node; + node.flags = static_cast(flutter::SemanticsFlags::kIsSlider); + SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0]; + [object setSemanticsNode:&node]; + [object accessibilityBridgeDidFinishUpdate]; + XCTAssertEqual([object accessibilityActivate], YES); +} + @end