Skip to content

Commit

Permalink
Make TextInput "clear text" button accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
haitaoli committed Dec 15, 2017
1 parent f4d627c commit 7f789a4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Libraries/Text/RCTUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ - (void)setEditable:(BOOL)editable
self.enabled = editable;
}

#pragma mark - Accessibility

- (BOOL)isAccessibilityElement {
// Always return NO to enumerate child elements. Otherwise the "clear text" button is hidden
// from accessibility interface.
return NO;
}

- (BOOL)accessibilityElementsHidden {
// If "accessible" prop is set to false on TextInput, disable all accessible children.
// Without this function the "clear text" UIButton is still exposed.
return ![super isAccessibilityElement];
}

#pragma mark - Caret Manipulation

- (CGRect)caretRectForPosition:(UITextPosition *)position
Expand Down

0 comments on commit 7f789a4

Please sign in to comment.