Skip to content

Commit e04aaf6

Browse files
sbuggaymeta-codesync[bot]
authored andcommitted
Avoid VoiceOver interruptions from hidden text updates (#59117)
Summary: Pull Request resolved: #59117 Honor `accessibilityElementsHidden` on text and its ancestors before posting layout-change notifications for changed text. This prevents hidden text updates from interrupting VoiceOver announcements for visible content. Reviewed By: philIip Differential Revision: D124686835 fbshipit-source-id: de717a041159d554ce5e2939f0172b2e05a55b88
1 parent 68b7ce2 commit e04aaf6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ - (void)updateState:(const State::Shared &)state oldState:(const State::Shared &
145145
const auto &newData = std::static_pointer_cast<const ParagraphShadowNode::ConcreteState>(state)->getData();
146146
const auto &oldData = std::static_pointer_cast<const ParagraphShadowNode::ConcreteState>(oldState)->getData();
147147
if (!newData.attributedString.isContentEqual(oldData.attributedString)) {
148+
// Changes inside a hidden subtree must not interrupt VoiceOver on visible content.
149+
UIView *view = self;
150+
while (view != nil) {
151+
if (view.accessibilityElementsHidden) {
152+
return;
153+
}
154+
view = view.superview;
155+
}
148156
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
149157
}
150158
}

0 commit comments

Comments
 (0)