Repository navigation
Conversation
|
Found potential problems with the pull request:
|
|
Before the review, could you add the native screen reader check your test plan mentions? A short clip each with TalkBack on Android and VoiceOver on iOS would be enough, showing:
"Related to #4757" is the right link: the empty space where the button sits stays, so that issue remains open. A heads-up: #5020 rewrites Searchbar and moves the file to While you're here: #5014 still needs |
|
Thanks for spelling out the swipe sequence and for the heads-up on #5020. The Chrome check covers the empty, populated, and cleared states. I haven't verified the native swipe order yet. VoiceOver needs a physical iOS device, and I don't have one connected here. I also refreshed #5014 against current main ( |
|
I found a way to test this with VoiceOver on the iOS 27 simulator. On the current PR commit ( |
Doberjohn
left a comment
There was a problem hiding this comment.
Thanks for porting this onto the rewritten Searchbar. Hiding the empty Clear button from assistive technology and from the tab order is the right fix, and the new test covers it well. Two things before it can merge:
-
onPress={value ? handleClearPress : undefined}undoes the reason the button stays mounted. Without a press handler, TouchableRipple renders a plainViewinstead of aPressable(its!isControlbranch, on web and on native). So when a press on Clear empties the field, thePressablethe ripple is drawn in gets replaced, and the ripple is cut off mid-animation on web and on Android. Could you keeponPress={handleClearPress}as onmain? The wrapper'spointerEvents="none"already stops touches while the field is empty (the existing "does not respond to touch" test covers that), andfocusable={false}witharia-hiddenkeep it out of the tab order and the accessibility tree. The comment above theViewthen stays true. -
When a keyboard user clears the field with Enter, the button they are on becomes hidden while it still has focus. Moving focus back to the input in
handleClearPress(root.current?.focus()) would fix that, and the input is where focus belongs after clearing.
Then the screen reader checks: the VoiceOver run was on 3fb596c, before the port, and TalkBack is still open. Could you rerun both on the latest commit once these are in?
|
Thanks, @Doberjohn. The Clear button now keeps its press handler and stays mounted as a Pressable, so clearing the query preserves the ripple host. Clearing also returns focus to the input. I set the empty button's tab index explicitly because React Native Web defaults Pressable to a tab stop while the handler is attached. I verified on 65e460e that Chrome skips the empty button, tabs to it with text present, and returns focus to the cleared input after Enter. The button kept the same DOM node. VoiceOver on an iOS 27 iPhone 18 Pro simulator skipped Clear when empty, announced “clear Button” with text present, and cleared the field on activation. After clearing, VoiceOver skipped the button again. All 1,799 Jest tests passed. TalkBack is still pending. No Android device was connected for this run. |
Motivation
An empty Searchbar's transparent Clear button still accepts keyboard focus and appears in the accessibility tree. Hide it from assistive technology and disable focus and activation until the field has text. Keep it mounted so the ripple can finish when the field is cleared.
Related issue
Related to #4757.
Screenshots / Videos
The layout stays the same.
Test plan
mainand passed with the fix. All 57 Jest suites, lint, and type checking passed.