Skip to content

Commit 1bf4bc0

Browse files
committed
Make TextInput "clear text" button accessible
1 parent f4d627c commit 1bf4bc0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Libraries/Text/RCTUITextField.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ - (void)setEditable:(BOOL)editable
8787
self.enabled = editable;
8888
}
8989

90+
#pragma mark - Accessibility
91+
92+
- (BOOL)isAccessibilityElement
93+
{
94+
// Always return NO to enumerate child elements. Otherwise the "clear text" button is hidden
95+
// from accessibility interface.
96+
return NO;
97+
}
98+
99+
- (BOOL)accessibilityElementsHidden
100+
{
101+
// If "accessible" prop is set to false on TextInput, disable all accessible children.
102+
// Without this function the "clear text" UIButton is still exposed.
103+
return ![super isAccessibilityElement];
104+
}
105+
90106
#pragma mark - Caret Manipulation
91107

92108
- (CGRect)caretRectForPosition:(UITextPosition *)position

0 commit comments

Comments
 (0)