Skip to content

[Awaiting Checklist] [Due for payment 2025-09-02] [$250] Search - Cursor is not visible when pasting a long text in search field #67210

Closed

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.1.84-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://github.com/Expensify/Expensify/issues/493003
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: macOS Sequoia 15.5
App Component: Search/Router

Action Performed:

  1. Go to staging.new.expensify.com
  2. Copy a long search query (eg, type:expense workspace:BD19AF1A66B0E7D8 hey hey hey hey hey hey hey hey)
  3. Click on the search modal on the top right.
  4. Paste the long search query.

Expected Result:

The cursor will remain visible at the end.

Actual Result:

The cursor is not visible. User will have to scroll to the end to see the cursor.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6897526_1753367872239.20250724_223422.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021950786823905045910
  • Upwork Job ID: 1950786823905045910
  • Last Price Increase: 2025-07-31
  • Automatic offers:
    • Krishna2323 | Contributor | 108265751
Issue OwnerCurrent Issue Owner: @garrettmknight

Activity

  1. added
    Daily
    Bug
    on Jul 26, 2025
  2. melvin-bot commented on Jul 26, 2025

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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.

  3. Krishna2323 commented on Jul 26, 2025

    @Krishna2323
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Search - Cursor is not visible when pasting a long text in search field

    What is the root cause of that problem?

    • The loading indicator container always takes the required space once the inputProps.isLoading turns to a boolean and in SearchAutocompleteInput, we are using animated TextInputClearButton, so there are two icons.
    • When pasting long text into the input, the input field expands to fill all available width (excluding the TextInputClearButton). However, once inputProps.isLoading is set to true, the ActivityIndicator appears, causing the text input to shrink slightly and cursor to be hidden.
      {inputProps.isLoading !== undefined && (
      <ActivityIndicator
      size="small"
      color={theme.iconSuccessFill}
      style={[
      StyleUtils.getTextInputIconContainerStyles(hasLabel, false),
      styles.ml1,
      styles.justifyContentStart,
      loadingSpinnerStyle,
      StyleUtils.getOpacityStyle(inputProps.isLoading ? 1 : 0),
      ]}
      />
      )}

      {!!value && (
      <Animated.View
      style={styles.pr3}
      layout={SearchFiltersButtonTransition}
      >
      <TextInputClearButton
      onPressButton={clearFilters}
      style={styles.mt0}
      />
      </Animated.View>
      )}
      </Animated.View>

    What changes do you think we should make in order to solve the problem?

    We have multiple ways to solve this issue:

    1. Instead of using the loading indicator from the input, we should render it inside SearchAutocompleteInput, we will hide the TextInputClearButton when isSearchingForReports is true. We also need to remove isLoading prop and loadingSpinnerStyle.
    {!!value && (
        <Animated.View
            style={styles.pr3}
            layout={SearchFiltersButtonTransition}
        >
            {!isSearchingForReports ? (
                <TextInputClearButton
                    onPressButton={clearFilters}
                    style={styles.mt0}
                />
            ) : (
                <ActivityIndicator
                    size="small"
                    color={theme.iconSuccessFill}
                    style={[
                        StyleUtils.getTextInputIconContainerStyles(false, false),
                        styles.ml1,
                        styles.justifyContentStart,
                        StyleUtils.getOpacityStyle(1),
                        styles.mt0,
                        styles.mr0,
                        styles.justifyContentCenter,
                    ]}
                />
            )}
        </Animated.View>
    )}
    1. Always pass a boolean to isLoading prop of TextInput, so the loading indicator always takes the required space and the input is rendered in the available space. Update the prop value isSearchingForReports to !!isSearchingForReports
    2. Update the condition below to !!inputProps.isLoading &&.
      {inputProps.isLoading !== undefined && (
    3. We can use shouldShowClearButton prop TextInput and remove the animated clear button in SearchAutocompleteInput, this will also required to add some props in TextInput to modify the clear button.
    • We should check for similar bugs in other components also, where we are using multiple icons. If we decide to update the text input component then we have to make changed in the native file also.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Result

    Result after solution 1

    Details
    Monosnap.screencast.2025-07-27.00-33-08.mp4

    Result after solution 2

    Details
    Monosnap.screencast.2025-07-27.00-35-09.mp4

    Result after solution 3

    Details
    Monosnap.screencast.2025-07-27.00-40-48.mp4
  4. lorretheboy commented on Jul 26, 2025

    @lorretheboy
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-08-01 14:08:32 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Search - Cursor is not visible when pasting a long text in search field

    What is the root cause of that problem?

    The loading indicator occupies space whenever isLoading has a boolean value—true, false, or even undefined as seen here. When a long string is pasted or the user types until the input reaches its full width, and the loading indicator appears for the first time, the input reserves space for the clear button (due to isLoading being true). This causes the ActivityIndicator to render over the suffix area, pushing the text and making the cursor invisible.

    {inputProps.isLoading !== undefined && (
    <ActivityIndicator
    size="small"
    color={theme.iconSuccessFill}
    style={[
    StyleUtils.getTextInputIconContainerStyles(hasLabel, false),
    styles.ml1,
    styles.justifyContentStart,
    loadingSpinnerStyle,
    StyleUtils.getOpacityStyle(inputProps.isLoading ? 1 : 0),
    ]}
    />
    )}

    What changes do you think we should make in order to solve the problem?

    Solution to reserve the area for loading, we just need to remove condition here

    {inputProps.isLoading !== undefined && (

    Other solutions:
    Should check explicit inputProps.isLoading === true here so that the loading indicator will only appear when it actually in loading state

    {inputProps.isLoading !== undefined && (

    Then the opacity style will be alway 1 StyleUtils.getOpacityStyle(1)

    StyleUtils.getOpacityStyle(inputProps.isLoading ? 1 : 0),

    Result:

    Screen.Recording.2025-07-27.at.04.27.34.mov

    Additionally, If we want to place the loading indicator over the clear button in loading state. This way, we only have 1 suffix icon either loading indicator or clear button

    Check !isSearchingForReports as well

    Replace styles.ml1 by

    styles.ph1,
    styles.ml2,

    Styles can be updated by on specific requirements if needed

    Result:

    Screen.Recording.2025-07-27.at.04.26.54.mov

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    NA

    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.

  5. kpadmanabhan commented on Jul 27, 2025

    @kpadmanabhan

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Cursor not visible in search RHN for long pasted text.
    Image
    The same behaviour is seen if you switch to another window and come back to new expensify, the cursor is missing, irrespective of whether it is pasted text or typed text. This is not an issue with long text. This is seen with short one word text as search input.

    What is the root cause of that problem?

    There are 2 problems here.

    • cursor going hidden due to appearance of activity indicator thats loaded for a long text
    • text field out of focus the moment we switch windows an hence while returning, focus is not on the text field and hence cursor is not displayed

    What changes do you think we should make in order to solve the problem?

    isLoding is assigned to isSearchingForReports which should have been a background activity. Also visible area should have been 1 space more to display blinking cursor.
    https://github.com/Expensify/App/blob/e36300de578fb39e3dc1a102a1cdfda5c710fd4d/src/components/Search/SearchAutocompleteInput.tsx#L236C25-L242

    Visibility of activity indicator is set to true once isLoading is true as well.

    {inputProps.isLoading !== undefined && (
    <ActivityIndicator
    size="small"
    color={theme.iconSuccessFill}
    style={[
    StyleUtils.getTextInputIconContainerStyles(hasLabel, false),
    styles.ml1,
    styles.justifyContentStart,
    loadingSpinnerStyle,
    StyleUtils.getOpacityStyle(inputProps.isLoading ? 1 : 0),
    ]}
    />
    )}

    Explicitly check for inputProps.isLoading === true from state, alongside undefined check, to ensure that it is visible only during actual loading of reports, instead of always.

    {inputProps.isLoading !== undefined && (
    <ActivityIndicator
    size="small"
    color={theme.iconSuccessFill}
    style={[
    StyleUtils.getTextInputIconContainerStyles(hasLabel, false),
    styles.ml1,
    styles.justifyContentStart,
    loadingSpinnerStyle,
    StyleUtils.getOpacityStyle(inputProps.isLoading ? 1 : 0),
    ]}
    />
    )}

    Also check if isSearchingForReports explicitly to decide whether to show activity indicator or not.

    {!!value && (
    <Animated.View
    style={styles.pr3}
    layout={SearchFiltersButtonTransition}
    >

    For the lost focus of text control while switching windows (ALT + TAB), pressing of ALT takes control to chrome settings button. This is a default chrome behaviour. Similar is with clicking on another window using mouse. Persist the tab index to state onLostFocus of window and set it back from state onWindowActive.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N.A.

    What alternative solutions did you explore? (Optional)

    N.A.

  6. RachCHopkins commented on Jul 30, 2025

    @RachCHopkins
    Contributor

    Legit long query (let's not use garbage):

    type:expense status:paid,approved,done group-by:reports feed:"testing 11121",,"Expensify Demo 11121" currency:USD expense-type:card reimbursable:no date<2025-06-30

    Image

    I'm seeing the cursor. I can't repro this.

    My version is v9.1.86-3 so maybe it's fixed already.

  7. added
    retest-weekly
    on Jul 30, 2025
  8. RachCHopkins commented on Jul 30, 2025

    @RachCHopkins
    Contributor

    Or maybe we just need better repro steps, it looks like @kpadmanabhan may have already come up with better repro steps here.

  9. Krishna2323 commented on Jul 30, 2025

    @Krishna2323
    Contributor

    @RachCHopkins, you can try directly pasting type:expense workspace:9132779747441AFB reportid:R00F3Ilaf4A8 date: or paste type:expense workspace:9132779747441AFB reportid:R00F3Ilaf4A8 date:2025-07-04, then select 2025-07-04 by dragging cursor and remove it.

    Monosnap.screencast.2025-07-30.13-14-33.mp4
  10. kpadmanabhan commented on Jul 30, 2025

    @kpadmanabhan

    Or maybe we just need better repro steps, it looks like @kpadmanabhan may have already come up with better repro steps here.

    @RachCHopkins : I am having 100% reproducibility using the steps mentioned in the description in Windows Chrome browser.
    Screenshot of the same is posted here
    The text being pasted just need to be long enough for the cursor to be hidden under the activity indicator. Content of the text pasted is not relevant.

    Also additionaly I noticed that switching window and coming back to expensify takes the cursor focus away from the search text field.

  11. izarutskaya commented on Jul 30, 2025

    @izarutskaya

    Reproducible on Windows 10/Chrome/Build 9.1.87-2

    2025-07-30.12-15-14.mp4
  12. RachCHopkins commented on Jul 31, 2025

    @RachCHopkins
    Contributor

    Thanks everyone!

  13. removed
    retest-weekly
    on Jul 31, 2025
  14. 41 remaining items

  15. garrettmknight commented on Sep 1, 2025

    @garrettmknight
    Contributor

    Payment summary:

  16. changed the title [-][Due for payment 2025-09-02] [$250] Search - Cursor is not visible when pasting a long text in search field[/-] [+][Awaiting Checklist] [Due for payment 2025-09-02] [$250] Search - Cursor is not visible when pasting a long text in search field[/+] on Sep 1, 2025
  17. Krishna2323 commented on Sep 1, 2025

    @Krishna2323
    Contributor

    Requested in NewDot!

  18. added
    Daily
    and removed
    Daily
    on Sep 1, 2025
  19. Pujan92 commented on Sep 2, 2025

    @Pujan92
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [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.

      Link to comment: https://github.com/Expensify/App/pull/58364/files#r2314942847

    • [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.

      Link to discussion: 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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    1. Copy a long search query(eg. type:expense workspace:9132779747441AFB reportid:R00F3Ilaf4A8 date:)
    2. Open search modal > Paste the query in the input
    3. Verify that the loading indicator is shown, and once loading is complete, it shows the clear button in the same place and hides the loading indicator
    4. Verify the cursor remains visible at the end

    Do we agree 👍 or 👎

  20. JmillsExpensify commented on Sep 2, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @Pujan92

  21. melvin-bot commented on Sep 4, 2025

    @melvin-bot

    @garrettmknight Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  22. flaviadefaria commented on Sep 8, 2025

    @flaviadefaria
    Contributor

    $250 approved for @Krishna2323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions