Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$500] Chat - The cursor appears before the last letter in the compose box when pasting #39272

Closed
1 of 6 tasks
m-natarajan opened this issue Mar 29, 2024 · 14 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 29, 2024

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: 1.4.58.0
Reproducible in staging?: Yes
Reproducible in production?: No
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
Expensify/Expensify Issue URL:
Issue reported by: Applause Internal Team
Slack conversation:

Action Performed:

  1. Send a multiline message in any chat
  2. Hover over the message
  3. Click on the "..." button
  4. Click on "Copy to clipboard"
  5. Paste it inside the compose box

Expected Result:

The cursor should appear after the last letter

Actual Result:

The cursor appears before the last letter in the compose box when copy/pasting multiline text

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

bandicam.2024-03-29.16-46-01-107.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01500831e0ec092b01
  • Upwork Job ID: 1774859672126918656
  • Last Price Increase: 2024-04-01
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

Triggered auto assignment to @tgolen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Mar 29, 2024

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

@github-actions github-actions bot added Hourly KSv2 and removed Daily KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot added the Daily KSv2 label Mar 29, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot melvin-bot bot removed the Hourly KSv2 label Mar 29, 2024
@m-natarajan
Copy link
Author

We think this bug might be related to #vip-vsb

@m-natarajan
Copy link
Author

@MitchExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@thienlnam thienlnam removed the DeployBlockerCash This issue or pull request should block deployment label Mar 29, 2024
@thienlnam thienlnam assigned thienlnam and unassigned tgolen Mar 29, 2024
@thienlnam
Copy link
Contributor

Not a blocker - added to the main tracking issue

@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2024
@MitchExpensify MitchExpensify added the External Added to denote the issue can be worked on by a contributor label Apr 1, 2024
@melvin-bot melvin-bot bot changed the title Chat - The cursor appears before the last letter in the compose box when pasting [$500] Chat - The cursor appears before the last letter in the compose box when pasting Apr 1, 2024
Copy link

melvin-bot bot commented Apr 1, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01500831e0ec092b01

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2024
Copy link

melvin-bot bot commented Apr 1, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Apr 1, 2024
@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 2, 2024

Proposal

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

Chat - The cursor appears before the last letter in the compose box when pasting

What is the root cause of that problem?

The main problem is that we use window.getSelection in conjunction with div

https://github.com/Expensify/react-native-live-markdown/blob/main/src/web/cursorUtils.ts#L113-L125

https://github.com/Expensify/react-native-live-markdown/blob/main/src/MarkdownTextInput.web.tsx#L537-L559

As result when we try to get range.legth we ignore each line break, so we have an offset (-1 for each new line)

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

To fix this issue we can use span instead of div

https://github.com/Expensify/react-native-live-markdown/blob/main/src/MarkdownTextInput.web.tsx#L537

And plus to save using styles for divs we need update display to block

https://github.com/Expensify/react-native-live-markdown/blob/main/src/MarkdownTextInput.web.tsx#L212-L223

I found a slightly similar problem here
https://stackoverflow.com/questions/63480153/window-getselection-baseoffset-is-wrong

Screen.Recording.2024-04-02.at.09.40.16.mov

What alternative solutions did you explore? (Optional)

Alternatively, we can update the result of window.getSelection()
and add the necessary offsets depending on what line we are on

@BartoszGrajdek
Copy link
Contributor

This issue is already being handled in a PR by @Skalakid #39177 (comment) @thienlnam please assign him to this task

@ntdiary
Copy link
Contributor

ntdiary commented Apr 2, 2024

This issue is already being handled in a PR by @Skalakid #39177 (comment) @thienlnam please assign him to this task

un-assign myself. :)

@ntdiary ntdiary removed their assignment Apr 2, 2024
@MitchExpensify
Copy link
Contributor

I think @Skalakid needs to comment here for us to assign them

@thienlnam thienlnam removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 3, 2024
@Skalakid
Copy link
Contributor

Skalakid commented Apr 4, 2024

Hi, I'm Michał from SWM, an expert agency. Please assign me to this task

@BartoszGrajdek
Copy link
Contributor

We should be able to close this one @thienlnam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

8 participants