Skip to content

Commit

Permalink
[a11y] fix VoiceOver navigation (#33)
Browse files Browse the repository at this point in the history
* [a11y] fix VoiceOver navigation

This commit disables removeClippedSubviews for all react views when VoiceOver is enabled on iOS. The issue is that VoiceOver relys on the view hierarchy to know how to navigate between elements when the user swipes left and right. When removeClippedSubviews is enabled, all views
offscreen are removed from the view hierarchy, causing VoiceOver to stop navigating when it gets to the last view rendered on screen. This PR fixes that by forcing removeClippedSubviews to be false for VoiceOver users.

* [a11y] fix VoiceOver navigation

This commit disables removeClippedSubviews for all react views when VoiceOver is enabled on iOS. The issue is that VoiceOver relys on the view hierarchy to know how to navigate between elements when the user swipes left and right. When removeClippedSubviews is enabled, all views
offscreen are removed from the view hierarchy, causing VoiceOver to stop navigating when it gets to the last view rendered on screen. This PR fixes that by forcing removeClippedSubviews to be false for VoiceOver users.
  • Loading branch information
thedrick authored Aug 15, 2017
1 parent d1daa2d commit 4f27b76
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ - (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:

- (void)setRemoveClippedSubviews:(BOOL)removeClippedSubviews
{
// removeClippedSubviews prevents VoiceOver from navigating through scrollViews properly,
// so we always disable removing clipped subviews when VoiceOver is active.
if (UIAccessibilityIsVoiceOverRunning()) {
RCTLogInfo(@"removeClippedSubviews is disabled when VoiceOver is active");
removeClippedSubviews = NO;
}
if (!removeClippedSubviews && _removeClippedSubviews) {
[self react_remountAllSubviews];
}
Expand Down

0 comments on commit 4f27b76

Please sign in to comment.