From e59be5a63d4b2fed0cdd56521181e32071969639 Mon Sep 17 00:00:00 2001 From: Bruno Leroux Date: Thu, 7 Nov 2024 17:15:38 +0100 Subject: [PATCH 1/3] Fix slider semantics node answer to accessibility activate --- .../darwin/ios/framework/Source/SemanticsObject.mm | 3 +++ .../ios/framework/Source/SemanticsObjectTest.mm | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm index 2fe38516f4f5f..c8d942641ec74 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm @@ -692,6 +692,9 @@ - (BOOL)accessibilityActivate { return NO; } if (!self.node.HasAction(flutter::SemanticsAction::kTap)) { + 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 From 6c8c1d181abc8f3be92dd18658d8bf969e5eb6e1 Mon Sep 17 00:00:00 2001 From: Bruno Leroux Date: Fri, 8 Nov 2024 08:28:50 +0100 Subject: [PATCH 2/3] Add comment --- shell/platform/darwin/ios/framework/Source/SemanticsObject.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm index c8d942641ec74..5c27c55c559b3 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm @@ -692,6 +692,8 @@ - (BOOL)accessibilityActivate { return NO; } if (!self.node.HasAction(flutter::SemanticsAction::kTap)) { + // Prevent Slider to receive a regular tap which will change the value. + // This is needed because Slider does not have a semantics tap. if (self.node.HasFlag(flutter::SemanticsFlags::kIsSlider)) { return YES; } From 03e925b230cf362b744d54054444a4343f14af35 Mon Sep 17 00:00:00 2001 From: Bruno Leroux Date: Tue, 12 Nov 2024 08:25:54 +0100 Subject: [PATCH 3/3] Update comment --- .../platform/darwin/ios/framework/Source/SemanticsObject.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm index 5c27c55c559b3..8212c2fd01f72 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm @@ -692,8 +692,10 @@ - (BOOL)accessibilityActivate { return NO; } if (!self.node.HasAction(flutter::SemanticsAction::kTap)) { - // Prevent Slider to receive a regular tap which will change the value. - // This is needed because Slider does not have a semantics tap. + // 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; }