Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shell/platform/darwin/ios/framework/Source/SemanticsObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explain the reasoning?

return YES;
}
return NO;
}
self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kTap);
Expand Down
14 changes: 14 additions & 0 deletions shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1206,4 +1206,18 @@ - (void)testUIFocusItemContainerConformance {
XCTAssertTrue([itemsInRect containsObject:child1]);
XCTAssertTrue([itemsInRect containsObject:child2]);
}

- (void)testSliderSemanticsObject {
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
new flutter::testing::MockAccessibilityBridge());
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();

flutter::SemanticsNode node;
node.flags = static_cast<int32_t>(flutter::SemanticsFlags::kIsSlider);
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
[object setSemanticsNode:&node];
[object accessibilityBridgeDidFinishUpdate];
XCTAssertEqual([object accessibilityActivate], YES);
}

@end