Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4fc35ac

Browse files
committed
replace node in child list when changing type
1 parent f7c8a19 commit 4fc35ac

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ - (CGRect)accessibilityFrame {
199199
// `rect` is in the physical pixel coordinate system. iOS expects the accessibility frame in
200200
// the logical pixel coordinate system. Therefore, we divide by the `scale` (pixel ratio) to
201201
// convert.
202-
CGFloat scale = [[[self bridge]->view() window] screen].scale;
202+
CGFloat scale = [[[self bridge] -> view() window] screen].scale;
203203
auto result =
204204
CGRectMake(rect.x() / scale, rect.y() / scale, rect.width() / scale, rect.height() / scale);
205-
return UIAccessibilityConvertFrameToScreenCoordinates(result, [self bridge]->view());
205+
return UIAccessibilityConvertFrameToScreenCoordinates(result, [self bridge] -> view());
206206
}
207207

208208
#pragma mark - UIAccessibilityElement protocol
@@ -223,29 +223,29 @@ - (id)accessibilityContainer {
223223
- (BOOL)accessibilityActivate {
224224
if (![self node].HasAction(blink::SemanticsAction::kTap))
225225
return NO;
226-
[self bridge]->DispatchSemanticsAction([self uid], blink::SemanticsAction::kTap);
226+
[self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kTap);
227227
return YES;
228228
}
229229

230230
- (void)accessibilityIncrement {
231231
if ([self node].HasAction(blink::SemanticsAction::kIncrease)) {
232232
[self node].value = [self node].increasedValue;
233-
[self bridge]->DispatchSemanticsAction([self uid], blink::SemanticsAction::kIncrease);
233+
[self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kIncrease);
234234
}
235235
}
236236

237237
- (void)accessibilityDecrement {
238238
if ([self node].HasAction(blink::SemanticsAction::kDecrease)) {
239239
[self node].value = [self node].decreasedValue;
240-
[self bridge]->DispatchSemanticsAction([self uid], blink::SemanticsAction::kDecrease);
240+
[self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kDecrease);
241241
}
242242
}
243243

244244
- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
245245
blink::SemanticsAction action = GetSemanticsActionForScrollDirection(direction);
246246
if (![self node].HasAction(action))
247247
return NO;
248-
[self bridge]->DispatchSemanticsAction([self uid], action);
248+
[self bridge] -> DispatchSemanticsAction([self uid], action);
249249
return YES;
250250
}
251251

@@ -485,13 +485,16 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
485485
// The node changed its type from text field to something else, or vice versa. In this
486486
// case, we cannot reuse the existing SemanticsObject implementation. Instead, we replace
487487
// it with a new instance.
488+
auto positionInChildlist =
489+
std::find(object.parent.children->begin(), object.parent.children->end(), object);
488490
[objects_ removeObjectForKey:@(node.id)];
489491
if (isTextField) {
490492
// Text fields are backed by objects that implement UITextInput.
491493
object = [[[TextInputSemanticsObject alloc] initWithBridge:this uid:uid] autorelease];
492494
} else {
493495
object = [[[FlutterSemanticsObject alloc] initWithBridge:this uid:uid] autorelease];
494496
}
497+
*positionInChildlist = object;
495498
objects_.get()[@(node.id)] = object;
496499
}
497500
}

0 commit comments

Comments
 (0)