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

[HOLD #27977][$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box #35369

Closed
1 of 6 tasks
kavimuru opened this issue Jan 30, 2024 · 22 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. 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 Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jan 30, 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: v1.4.33-0
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
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

Pre-requisite: user must be logged in.

  1. Go to any chat.
  2. Tap on the compose box.
  3. Tap on Enter until you have entered more than 6 lines.

Expected Result:

The cursor should be displayed no matter how many lines are being entered.

Actual Result:

The cursor disappears after more than 6 lines have been entered.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

Bug6360353_1706581410106.Ryzu6837_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01dd5527568c5f7f46
  • Upwork Job ID: 1752276854903971840
  • Last Price Increase: 2024-01-30
@kavimuru kavimuru 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 Jan 30, 2024
@melvin-bot melvin-bot bot changed the title Chat - Cursor is not displayed after 6 lines have been entered in compose box [$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box Jan 30, 2024
Copy link

melvin-bot bot commented Jan 30, 2024

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

Copy link

melvin-bot bot commented Jan 30, 2024

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

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

melvin-bot bot commented Jan 30, 2024

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

Copy link

melvin-bot bot commented Jan 30, 2024

📣 @rayanetech! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@aswin-s
Copy link
Contributor

aswin-s commented Jan 31, 2024

Proposal

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

Cursor goes out of view after adding more than 6 lines

What is the root cause of that problem?

For small screen devices, the max number of lines for Composer input is set to 6 lines. On mobile safari beyond this height overflow scroll behaviour sets in. So even though the scroll height of TextArea increases the visible area of the TextArea is limited to 6 lines. So cursor moves beyond the visible area when new line is entered beyond 6 lines. That's the reason cursor gets hidden.

However when user enters any other character the scroll position is reset to the cursor position making the cursor visible again.

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

The scroll position of the Composer TextArea should be set to the cursor position at all times, even when the character entered is a new line. To acheive this we already have a hook updateMultilineInputRange that sets scrollTop to current scroll height of input. But for ComposerWithSuggestion it gets invoked only on mount as the dependency array of useEffect hook is set to [].

useEffect(() => {
// Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit
updateMultilineInputRange(textInputRef.current, shouldAutoFocus);
if (value.length === 0) {
return;
}
Report.setReportWithDraft(reportID, true);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Instead add value to dependency array so that the scroll position is set whenever value changes. This ensures that scroll position is maintained even when new line is entered.

useEffect(() => {
  // Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit
  updateMultilineInputRange(textInputRef.current, shouldAutoFocus);

  if (value.length === 0) {
    return;
  }

  Report.setReportWithDraft(reportID, true);
  
  // Add value as a dependency so that the hook runs on value change
  // eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]); 

Result

Before After
before.mp4
fix.mp4

What alternative solutions did you explore? (Optional)

None

@melvin-bot melvin-bot bot added the Overdue label Feb 1, 2024
Copy link

melvin-bot bot commented Feb 2, 2024

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

@mananjadhav
Copy link
Collaborator

@aswin-s's proposal seems to be working. I can see both the videos are iOS native, @aswin-s but the header says Web on the right.

🎀 👀 🎀 C+ Reviewed.

Copy link

melvin-bot bot commented Feb 2, 2024

Triggered auto assignment to @danieldoglas, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@aswin-s
Copy link
Contributor

aswin-s commented Feb 2, 2024

@aswin-s's proposal seems to be working. I can see both the videos are iOS native, @aswin-s but the header says Web on the right.

🎀 👀 🎀 C+ Reviewed.

@mananjadhav Ah my bad! It was supposed to be before and after videos. Both videos are for iOS mWeb. Will fix the titles shortly.

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@danieldoglas
Copy link
Contributor

I think this looks good, but I wonder if adding value to the useEffect will cause performance degradation here.

@thienlnam would love your opinion on this case since you were working on the new composer!

@melvin-bot melvin-bot bot removed the Overdue label Feb 5, 2024
@thienlnam
Copy link
Contributor

Looks like this was created before live markdown was added - let's see if this is still reproducible first and then if it is, it would likely be independent of the live markdown changes and can be addressed seperately

@mananjadhav
Copy link
Collaborator

@kavimuru Based on the previous comment, can you please retest this?

@aswin-s
Copy link
Contributor

aswin-s commented Feb 7, 2024

MarkdownTextInput was added only for native platforms. This is still reproducible on main.

@danieldoglas
Copy link
Contributor

Yes, but we're also merging the new markdown on web soon. Let's wait on that before trying to solve this issue. moving this to weekly until then.

@danieldoglas danieldoglas added Weekly KSv2 and removed Daily KSv2 labels Feb 8, 2024
@danieldoglas danieldoglas changed the title [$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box [HOLD][$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box Feb 8, 2024
@mananjadhav
Copy link
Collaborator

@danieldoglas @thienlnam Do we have any PR or issue that we can link against?

@danieldoglas
Copy link
Contributor

The web implementation was merged yesterday in the react-live-markdown repo Expensify/react-native-live-markdown#32, and it looks like it's making it's way to web here #35837

@thienlnam
Copy link
Contributor

Live markdown web has been merged!

@mananjadhav
Copy link
Collaborator

@kavimuru Is this still reproducible?

@thienlnam
Copy link
Contributor

We actually ended up reverted the PR, but I'm going to update the issue it's held on so we can wait until then

@thienlnam thienlnam changed the title [HOLD][$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box [HOLD #27977][$500] Chat - Cursor is not displayed after 6 lines have been entered in compose box Feb 12, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 20, 2024
@danieldoglas
Copy link
Contributor

still on hold

@melvin-bot melvin-bot bot removed the Overdue label Feb 20, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 28, 2024
@garrettmknight
Copy link
Contributor

Still holding on #279877

@melvin-bot melvin-bot bot removed the Overdue label Feb 28, 2024
@garrettmknight
Copy link
Contributor

Looks like it's fixed, closing!

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. 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 Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants