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 - Text partially cut for last text on paste of long text #28847

Closed
2 of 6 tasks
kbecciv opened this issue Oct 4, 2023 · 21 comments
Closed
2 of 6 tasks

[$500] Chat - Text partially cut for last text on paste of long text #28847

kbecciv opened this issue Oct 4, 2023 · 21 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Oct 4, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open the app
  2. Open any report
  3. Type in multiline text which just triggers scroll and copy it or copy similar length text from any other source
  4. Paste it in composer and observe that last line text is displayed partially cut

Expected Result:

App should scroll to bottom to ensure that pasted text is displayed fully

Actual Result:

App should scroll to bottom to ensure that pasted text is displayed fully

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.77.5
Reproducible in staging?: y
Reproducible in production?: y
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

mac.desktop.paste.scroll.half.text.mov
mac.chrome.paste.scroll.half.text.mov
windows.chrome.partially.cut.text.on.paste.mp4
Recording.4853.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696347080023239

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f1d1d117c4970023
  • Upwork Job ID: 1709626352655679488
  • Last Price Increase: 2023-10-11
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 4, 2023
@melvin-bot melvin-bot bot changed the title Chat - Text partially cut for last text on paste of long text [$500] Chat - Text partially cut for last text on paste of long text Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f1d1d117c4970023

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

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

@saiKumarGanji
Copy link

saiKumarGanji commented Oct 4, 2023

Proposal

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

On paste of long text which just triggers scroll, the text is getting partially cut, instead of displaying until the bottom

What is the root cause of that problem?

The textarea element on paste is not scrolling entirely down, which results in partial text cut

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

When we copy into textarea, we can catch the copy event and set the textarea scroll to the bottom using js dom methods

What alternative solutions did you explore? (Optional)

NA

@nebiyuelias1
Copy link

Proposal

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

When pasting a very long text, the composer is not scrolled all the way to the bottom. It's scrolled partially. But it seems this happens only for edge cases. If the text is substantially long it's scrolled fully.

What is the root cause of that problem?

It seems the Composer was refactored into a FC with this PR. Inside the updateNumberOfLines function. It seems the author used a workaround of setting height to 0 first and then to auto, and it seems it's having a jumping effect. But it doesn't guarantee it will be scrolled all the way.

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

To ensure it's scrolled all the way to the bottom we can include something like the following inside the updateNumberOfLines function to make sure it will always be scrolled all the way to the bottom:
textInput.current.scrollTop = textInput.current.scrollHeight;

What alternative solutions did you explore? (Optional)

@hoangzinh
Copy link
Contributor

I gonna review current proposals today.

@hoangzinh
Copy link
Contributor

@saiKumarGanji @nebiyuelias1 Thanks for your proposals. I don't think it's correct. Your proposal could lead to a regression bug where a user is typing somewhere in the middle of the composer, and tries to copy and paste something then it would scroll to the end of the composer instead of staying focused in the end of pasting text.

@melvin-bot melvin-bot bot added the Overdue label Oct 9, 2023
@lschurr
Copy link
Contributor

lschurr commented Oct 9, 2023

Waiting on new proposals.

@melvin-bot melvin-bot bot removed the Overdue label Oct 9, 2023
@nebiyuelias1
Copy link

I don't think it's correct. Your proposal could lead to a regression bug where a user is typing somewhere in the middle of the composer, and tries to copy and paste something then it would scroll to the end of the composer instead of staying focused in the end of pasting text.

But after doing some tests on the staging environment, it seems that's what is happening even with the current implementation. So I don't think it will be a regression. But what other problem could my proposal create? It's a very strange issue because when the text you're pasting is greater than numberOfLines + 2, it's being scrolled without no problem.

@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@hoangzinh
Copy link
Contributor

hoangzinh commented Oct 11, 2023

@nebiyuelias1 please take a look at my recording before and after applying your proposal. The composer jumps every time I paste a text

Screen.Recording.2023-10-11.at.23.48.22.mov

@hoangzinh
Copy link
Contributor

hoangzinh commented Oct 11, 2023

btw @lschurr can you reproduce this bug? I couldn't, it works normally from my end

Screen.Recording.2023-10-11.at.23.51.19.mov

@nebiyuelias1
Copy link

@nebiyuelias1 take a look at my recording before and after applying your proposal. The composer jumps every time I paste a text

Screen.Recording.2023-10-11.at.23.48.22.mov

Ok thank you for showing me the problem. Well what if I actually do the manual scrolling only when pasting text? Do you think that will solve the problem?

@hoangzinh
Copy link
Contributor

@nebiyuelias1 I think we should find out the root cause first. Otherwise, all proposals might be work-around solutions. We need to find out the root cause and fix it.

@nebiyuelias1
Copy link

btw @lschurr can you reproduce this bug? I couldn't, it works normally from my end

Screen.Recording.2023-10-11.at.23.51.19.mov

That's probably because you've added a multiline text with more than 17 rows. This bug happens only when you have 17 lines of text. The default behavior of HTML textarea is consistent with the partial problem we have. I just couldn't figure out where we're actually manually scrolling.

@nebiyuelias1
Copy link

@hoangzinh you can look this pr from the past. Basically, they tried changing the focus of the element and as a result, the browser automatically scrolls the content. But the browser's behavior is not always consistent it seems. It will have a partial scroll on text content that is not very large. So I don't see any other way to fix this issue other than manually scrolling it ourselves. But making sure our scrolling code only happens for pasting events. The pr basically removed the change I was suggesting because it had unintended side effects like the one you described.

@hoangzinh
Copy link
Contributor

Great finding @nebiyuelias1. Actually, I tried with 17 lines but I couldn't reproduce this bug, is it related to a specific browser? If you can reproduce this bug, can you share your recording? @nebiyuelias1 . Thanks

Screen.Recording.2023-10-12.at.18.17.14.mov

@nebiyuelias1
Copy link

@hoangzinh The text is not partially cut anymore. It's just that the scrollbar is not scrolled all the way to the bottom. When this issue was first created the problem was that the text was being partially cut but I'm no longer observing that behavior. So I feel like we might have wasted time on this issue. You can probably close it.

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@lschurr
Copy link
Contributor

lschurr commented Oct 16, 2023

Going to close!

@lschurr lschurr closed this as completed Oct 16, 2023
@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@hoangzinh
Copy link
Contributor

@nebiyuelias1 It's great. looking forward to seeing your proposals in other issues.

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

5 participants