Skip to content

[$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field #21727

Closed
Expensify/react-native-web
#21

Description

@lanitochka17

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


Issue found when executing PR #21367

Action Performed:

  1. Login to NewDot
  2. Open chat
  3. Tap password protected pdf
  4. Tap enter password
  5. Type several characters
  6. Tap Eye icon

Expected Result:

Cursor should stay where it was

Actual Result:

Cursor moves to the start fo the field

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.33.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:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6108545_video_33__1_.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f00fa406bef36c56
  • Upwork Job ID: 1674042523612561408
  • Last Price Increase: 2023-06-28
Issue OwnerCurrent Issue Owner: @laurenreidexpensify

Activity

  1. added
    Daily
    Bug
    on Jun 27, 2023
  2. melvin-bot commented on Jun 27, 2023

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on Jun 27, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. dummy-1111 commented on Jun 28, 2023

    @dummy-1111
    Contributor

    Proposal

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

    Tapping eye icon for protected pdf file moves cursor to the start

    What is the root cause of that problem?

    Please check the code below

    onMouseDown={(e) => e.preventDefault()}

    I'm not sure what does this code do but preventing default action on mousedown event makes TextInput works weird.

    In addition, TextInput cursor goes to the end when toggle secureTextEntry in iOS native as you can see below

    TextInput cursor goes to the beginning when toggle secureTextEntry in iOS safari.

    These are the root cause of the issue.

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

    Prevent default action for mouseup event. Add onMouseUp props to the Checkbox and add the following code here

    onMouseDown={(e) => e.preventDefault()}

                onMouseUp={(e) => e.preventDefault()}
    

    In iOS safari and iOS native, we need to control selection manually.

    Add the selection state

        const [selection, setSelection] = useState(props.selection);
    

    For iOS safari, get selection from the input element when toggle

        const togglePasswordVisibility = useCallback(() => {
            if (getPlatform() === CONST.PLATFORM.WEB) {
                setSelection({start: input.current.selectionStart, end: input.current.selectionEnd});
            }
            setPasswordHidden((prevState) => !prevState);
        }, []);
    

    For iOS native, add onSelectionChange to get selection, and set selection manually when secureTextEntry toggles because control selection doesn't work well.

        useEffect(() => {
            if (getPlatform() === CONST.PLATFORM.IOS) {
                input.current.setNativeProps({selection});
            }
        }, [passwordHidden])
    
        onSelectionChange={getPlatform() === CONST.PLATFORM.IOS ? (e) => setSelection(e.nativeEvent.selection) : undefined}
    
    Result
    21727_mac_chrome.mp4

    What alternative solutions did you explore? (Optional)

  5. added
    External
    on Jun 28, 2023
  6. changed the title [-]Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/-] [+][$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/+] on Jun 28, 2023
  7. melvin-bot commented on Jun 28, 2023

    @melvin-bot
  8. added
    Help Wanted
    on Jun 28, 2023
  9. melvin-bot commented on Jun 28, 2023

    @melvin-bot

    Current assignee @laurenreidexpensify is eligible for the External assigner, not assigning anyone new.

  10. melvin-bot commented on Jun 28, 2023

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

  11. rain2o commented on Jun 28, 2023

    @rain2o
    Contributor

    I think an important question is, what is the expected behavior? As @s-alves10 mentioned in his proposal, we have onMouseDown={(e) => e.preventDefault()} on the checkbox surrounding the eye icon. This prevents the checkbox from gaining focus when we click on it and keeps focus on the text input.

    The solution he proposed "fixes" it, in that it allows the checkbox to gain focus when you click it. However, this could cause unexpected behavior for users, if they click it, then continue to type because focus will no longer be in the textbox. But, from an accessibility standpoint, I think it does make sense for it to behave this way, otherwise we'd have different behavior for click vs tab+space.

    The decision on how this is expected to behave could determine if a different change is required or not.

  12. dummy-1111 commented on Jun 28, 2023

    @dummy-1111
    Contributor

    Please check the alternative as well

  13. 112 remaining items

  14. laurenreidexpensify commented on Nov 8, 2023

    @laurenreidexpensify
    Contributor

    @pac-guerreiro @sobitneupane is there any latest here?

  15. pac-guerreiro commented on Nov 20, 2023

    @pac-guerreiro
    Contributor

    @laurenreidexpensify I'm still waiting on updates from React Native PR

  16. pac-guerreiro commented on Nov 27, 2023

    @pac-guerreiro
    Contributor

    Still no updates on React Native PR

  17. pac-guerreiro commented on Dec 7, 2023

    @pac-guerreiro
    Contributor

    Still no updates on React Native PR

  18. pac-guerreiro commented on Dec 18, 2023

    @pac-guerreiro
    Contributor

    When the app starts using RN 0.73.1, I'll check if the new version fixes the underlying issue 😄

  19. changed the title [-][$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/-] [+]Hold on #31381 [$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/+] on Jan 15, 2024
  20. laurenreidexpensify commented on Jan 22, 2024

    @laurenreidexpensify
    Contributor

    Still holding on #31381

  21. laurenreidexpensify commented on Feb 8, 2024

    @laurenreidexpensify
    Contributor

    @pac-guerreiro looks like #31381 is live - we have Upgraded react-native to 0.73+ so can we pick this one up again?

  22. changed the title [-]Hold on #31381 [$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/-] [+][$1000] Chat - Tapping eye icon for protected pdf file moves cursor to the start of the field[/+] on Feb 8, 2024
  23. pac-guerreiro commented on Feb 9, 2024

    @pac-guerreiro
    Contributor

    @laurenreidexpensify Thanks for the heads up! I'll test this asap!

  24. pac-guerreiro commented on Feb 9, 2024

    @pac-guerreiro
    Contributor
    Screen.Recording.2024-02-09.at.19.07.42.mp4

    @laurenreidexpensify The issue still persists on iOS. I reported this on react/react-native#38676

    Meanwhile, I could apply this fix through a patch if you want, otherwise we'll have to wait on meta team response.

  25. laurenreidexpensify commented on Feb 20, 2024

    @laurenreidexpensify
    Contributor

    @pac-guerreiro have Meta responded yet?

  26. pac-guerreiro commented on Feb 21, 2024

    @pac-guerreiro
    Contributor

    @laurenreidexpensify Nothing so far but I just bumped them 😄

  27. laurenreidexpensify commented on Mar 21, 2024

    @laurenreidexpensify
    Contributor

    I am going to close this. It feels like an edge case, and we can reopen if this is ever reported as an issue by live customers.

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

Metadata

Metadata

Labels

BugEngineeringExternalReviewingWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions