You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-03-02] iOS - Company cards - Tapping the X in the input field closes the keyboard #82363
Please re-state the problem that we are trying to solve in this issue.
Tapping the X closes the keyboard, to clear the input field the user needs to tap again.
What is the root cause of that problem?
The TextInputClearButton component uses onMouseDown with e.preventDefault() to prevent losing focus when clicking the clear button, but this only works on web platforms. On native mobile (iOS/Android), the onMouseDown event doesn't exist - when the user taps the clear button (X), the tap causes the TextInput to lose focus, which dismisses the keyboard.
The PressableWithoutFeedback component receives the tap, which triggers the native responder system and causes the TextInput to blur before onPress is executed.
What changes do you think we should make in order to solve the problem?
We should refocus the TextInput after clearing the input on native platforms. We can achieve this by passing an inputRef to the TextInputClearButton and calling inputRef.current?.focus() after clearing the input.
Update TextInputClearButton to accept an optional inputRef:
What alternative solutions did you explore? (Optional)
Use Keyboard.dismiss() prevention: React Native doesn't provide a direct way to prevent keyboard dismissal when tapping outside the input.
Use keyboardShouldPersistTaps="handled": This is typically used on ScrollView/FlatList containers but wouldn't work here since the clear button is part of the TextInput component itself.
Platform-specific component: Create a native-specific TextInputClearButton that handles the focus differently, but the refocus approach is simpler and works across all platforms without code duplication.
The recommended solution (refocusing the input after clearing) is the simplest and most reliable approach that maintains consistent behavior across all platforms.
Please re-state the problem that we are trying to solve in this issue.
iOS - Company cards - Tapping the X in the input field closes the keyboard
What is the root cause of that problem?
We don't pass the keyboardShouldPersistTaps prop anywhere on the page, so onBlur always fires on the first click, even if we click on an element inside the input:
PS: This can be done dynamically and controlled via props if we don't want this behavior throughout the project.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Company Cards, when the user taps the search input, types something, and then taps the X to clear the search
What is the root cause of that problem?
On iOS, when the user taps the clear (X) button, the touch target is the PressableWithoutFeedback inside TextInputClearButton. That press moves focus from the TextInput to the clear button. The TextInput loses focus, so iOS dismisses the keyboard. The clear handler then runs (setValue(''), onClearInput?.()), so the field is cleared but the keyboard has already been dismissed.
The relevant clear-button handling lives in the native BaseTextInput implementation. The clear button is rendered here:
No refocus is performed after clearing, so the input remains unfocused and the keyboard stays closed.
What changes do you think we should make in order to solve the problem?
Refocus the text input after clearing in the native BaseTextInput implementation so the keyboard remains open. Use setTimeout(..., 0) to schedule the focus after the clear button’s press handling completes, so the input reliably receives focus again.
⚠️@abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.24-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@suneox@lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
While working on another task, I noticed a very similar bug on the Expensify cards page. The problem is the same here:
When you click the “X” button, the keyboard closes and the input loses focus.
There is a hint in the keyboard (autoCorrect) that is not present on the company Cards page. Also, because of these hints, if you enter incorrect text, the first tap on x will be ignored.
Here is the bug report itself:
2026-03-02.23.03.58.mov
I think that since I have already worked on a similar task and it was successfully completed, and I found a similar bug, we can follow up and fix this bug as well. I already had experience with this kind of work when the original bug was fixed, but several similar ones were found when the main PR was already merged, and as far as I know, this is normal practice. Either a separate task is created, or it is done within the same task, simply changing the price. What do you think about it @suneox@chiragsalian?
Regarding the second point, we can discuss what behavior we want autoCorrect to have or not, since on iOS, the default behavior is that the first click will highlight the suggestion. Here are two videos I recorded:
Without autoCorrect, there is no top menu above the keyboard. Clearing occurs on the first click:
2026-03-02.23.23.31.mov
With autoCorrect. The first click replaces the text with the correct one, and only the second click clears it:
2026-03-02.23.23.10.mov
As far as I understand, autoCorrect is currently enabled throughout the entire project, so we may not need to change anything. Only the Company cards page is different, and autoCorrect is disabled there. But if it is needed on some pages and not on others, you can add props and control it through props. Or we can change the approach on the Company cards page to match the approach across the entire project.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
I think that since I have already worked on a similar task and it was successfully completed, and I found a similar bug, we can follow up and fix this bug as well. I already had experience with this kind of work when the original bug was fixed, but several similar ones were found when the main PR was already merged, and as far as I know, this is normal practice. Either a separate task is created, or it is done within the same task, simply changing the price. What do you think about it @suneox@chiragsalian?
@Eskalifer1 Currently, the scope of this issue has been resolved. If we identify another place that isn’t covered by the current solution, we can certainly review your new proposal, but your RCA between SearchBar and TableSearchBar doesn’t show a clear distinction. Therefore, it would be better to open a new issue with a detailed RCA specific to that case.
Activity
melvin-bot commentedon Feb 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (
External)melvin-bot commentedon Feb 13, 2026
Triggered auto assignment to @lydiabarclay (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon Feb 13, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
daledah commentedon Feb 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Tapping the X closes the keyboard, to clear the input field the user needs to tap again.
What is the root cause of that problem?
The
TextInputClearButtoncomponent usesonMouseDownwithe.preventDefault()to prevent losing focus when clicking the clear button, but this only works on web platforms. On native mobile (iOS/Android), theonMouseDownevent doesn't exist - when the user taps the clear button (X), the tap causes the TextInput to lose focus, which dismisses the keyboard.App/src/components/TextInput/TextInputClearButton/index.tsx
Lines 24 to 31 in b529010
The
PressableWithoutFeedbackcomponent receives the tap, which triggers the native responder system and causes the TextInput to blur beforeonPressis executed.What changes do you think we should make in order to solve the problem?
We should refocus the TextInput after clearing the input on native platforms. We can achieve this by passing an
inputRefto theTextInputClearButtonand callinginputRef.current?.focus()after clearing the input.Update
TextInputClearButtonto accept an optionalinputRef:Then pass the input ref from
BaseTextInput(inindex.native.tsx) toTextInputClearButton:<TextInputClearButton onPressButton={() => { setValue(''); onClearInput?.(); }} style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff)]} + inputRef={input} />What alternative solutions did you explore? (Optional)
Use
Keyboard.dismiss()prevention: React Native doesn't provide a direct way to prevent keyboard dismissal when tapping outside the input.Use
keyboardShouldPersistTaps="handled": This is typically used on ScrollView/FlatList containers but wouldn't work here since the clear button is part of the TextInput component itself.Platform-specific component: Create a native-specific
TextInputClearButtonthat handles the focus differently, but the refocus approach is simpler and works across all platforms without code duplication.The recommended solution (refocusing the input after clearing) is the simplest and most reliable approach that maintains consistent behavior across all platforms.
Eskalifer1 commentedon Feb 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
iOS - Company cards - Tapping the X in the input field closes the keyboard
What is the root cause of that problem?
We don't pass the
keyboardShouldPersistTapsprop anywhere on the page, so onBlur always fires on the first click, even if we click on an element inside the input:App/src/pages/workspace/companyCards/WorkspaceCompanyCardsTable/index.tsx
Lines 316 to 326 in 4e0897a
What changes do you think we should make in order to solve the problem?
We need to pass this props to Table.Body, then the input will remain in focus when attempting to clear the field:
App/src/components/Table/TableBody.tsx
Lines 77 to 83 in 4e0897a
PS: This can be done dynamically and controlled via props if we don't want this behavior throughout the project.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
abbasifaizan70 commentedon Feb 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Company Cards, when the user taps the search input, types something, and then taps the X to clear the search
What is the root cause of that problem?
On iOS, when the user taps the clear (X) button, the touch target is the
PressableWithoutFeedbackinsideTextInputClearButton. That press moves focus from theTextInputto the clear button. TheTextInputloses focus, so iOS dismisses the keyboard. The clear handler then runs (setValue(''),onClearInput?.()), so the field is cleared but the keyboard has already been dismissed.The relevant clear-button handling lives in the native
BaseTextInputimplementation. The clear button is rendered here:App/src/components/TextInput/BaseTextInput/implementation/index.native.tsx
Lines 432 to 440 in 4341230
No refocus is performed after clearing, so the input remains unfocused and the keyboard stays closed.
What changes do you think we should make in order to solve the problem?
Refocus the text input after clearing in the native
BaseTextInputimplementation so the keyboard remains open. UsesetTimeout(..., 0)to schedule the focus after the clear button’s press handling completes, so the input reliably receives focus again.App/src/components/TextInput/BaseTextInput/implementation/index.native.tsx
Lines 432 to 440 in 4341230
{((isFocused && !isReadOnly && shouldShowClearButton) || !shouldHideClearButton) && !!value && !inputProps.isLoading && ( <TextInputClearButton onPressButton={() => { setValue(''); onClearInput?.(); + // Refocus the input so the keyboard stays open on iOS when clearing + setTimeout(() => { + input.current?.focus(); + }, 0); }} style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff)]} /> )}This keeps the keyboard open after tapping the X in Company Cards (and any other screen that uses
TextInputwith the clear button on native).github-actions commentedon Feb 13, 2026
lydiabarclay commentedon Feb 13, 2026
Upwork job: https://www.upwork.com/jobs/~022022397795011684661
13 remaining items
melvin-bot commentedon Feb 23, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Feb 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.24-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-03-02. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Feb 23, 2026
@suneox @lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
lydiabarclay commentedon Mar 2, 2026
@suneox please fill out the BZ checklist!
lydiabarclay commentedon Mar 2, 2026
Payment Summary
Contributor: @Eskalifer1 paid $250 via Upwork
Contributor+: @suneox due $250 via NewDot
✅ No regression test needed
Eskalifer1 commentedon Mar 2, 2026
Hi everyone!
While working on another task, I noticed a very similar bug on the Expensify cards page. The problem is the same here:
Here is the bug report itself:
2026-03-02.23.03.58.mov
I think that since I have already worked on a similar task and it was successfully completed, and I found a similar bug, we can follow up and fix this bug as well. I already had experience with this kind of work when the original bug was fixed, but several similar ones were found when the main PR was already merged, and as far as I know, this is normal practice. Either a separate task is created, or it is done within the same task, simply changing the price. What do you think about it @suneox @chiragsalian?
Here is the solution for this specific case:
App/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx
Lines 267 to 270 in 91e692a
App/src/components/SearchBar.tsx
Lines 32 to 46 in 91e692a
Regarding the second point, we can discuss what behavior we want autoCorrect to have or not, since on iOS, the default behavior is that the first click will highlight the suggestion. Here are two videos I recorded:
2026-03-02.23.23.31.mov
2026-03-02.23.23.10.mov
As far as I understand, autoCorrect is currently enabled throughout the entire project, so we may not need to change anything. Only the Company cards page is different, and autoCorrect is disabled there. But if it is needed on some pages and not on others, you can add props and control it through props. Or we can change the approach on the Company cards page to match the approach across the entire project.
suneox commentedon Mar 3, 2026
BugZero Checklist
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
https://github.com/Expensify/App/pull/77788/changes#r2878106249
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
N/A: It isn't an impactful bug
suneox commentedon Mar 3, 2026
@Eskalifer1 Currently, the scope of this issue has been resolved. If we identify another place that isn’t covered by the current solution, we can certainly review your new proposal, but your RCA between SearchBar and TableSearchBar doesn’t show a clear distinction. Therefore, it would be better to open a new issue with a detailed RCA specific to that case.
lydiabarclay commentedon Mar 3, 2026
Closing, payment summary here
trjExpensify commentedon Mar 6, 2026
approved $250 for @suneox