-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Awaiting checklist] [$250] Composer - Cursor Position Resets to Start of Message on Page Refresh #44259
Comments
Triggered auto assignment to @twisterdotcom ( |
@twisterdotcom 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 |
We think that this bug might be related to #vip-vsp |
This issue is possibly related to live markdown, please add it to the project 🙏🏻 cc @thienlnam |
@twisterdotcom I believe this issue could be resolved by external contributors. can we open it up for proposals? |
Job added to Upwork: https://www.upwork.com/jobs/~0121d7a8303e8c6df6 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Cursor position reverts to the beginning of the message when the page is refreshed. What is the root cause of that problem?The root cause is that the input field’s state, including the What changes do you think we should make in order to solve the problem?We need to check if value exist at first render and move cursor to the end if (value && value.length > 0) {
setSelection({
start: value.length,
end: value.length
});
} Here we can add this App/src/components/Composer/index.tsx Lines 235 to 250 in 4ee43a3
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
ProposalPlease re-state the problem that we are trying to solve in this issue. What is the root cause of that problem? What changes do you think we should make in order to solve the problem?
this will ensure that the caret is always placed in the end of the text. There would no need to add another useEffect or store the position of the caret everytime when the data changes in the page. |
@grogou @iCodePrograms Thanks for your proposal. I don't think your RCA is correct. We already trigger scroll and set selection on mount here App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 708 to 712 in e78c38e
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Cursor/selection position resets to the start of the message when refreshing. What is the root cause of that problem?When the composer mounts, we already call a function to set the selection based on the text length. App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 708 to 712 in 4622e19
App/src/libs/updateMultilineInputRange/index.ts Lines 17 to 24 in 4622e19
However, What changes do you think we should make in order to solve the problem?Add
The code that we will add is actually the same as this one, but I just simplify it for testing purpose. I think we can create a new function for that to make it reusable. But this isn't enough because there is a problem with the app composer code. There is a App/src/components/Composer/index.tsx Lines 117 to 124 in 4622e19
The App/src/components/Composer/index.tsx Lines 90 to 101 in 4622e19
Based on the react doc, using a set state function updater, the updater will be queued. Instead of doing that, we can just do it like this:
|
@twisterdotcom, @hoangzinh Whoops! This issue is 2 days overdue. Let's get this updated quick! |
One more proposal from @bernhardoj here @hoangzinh. |
@bernhardoj can you help me understand this? When I put console.log here, it's true that |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Because we set the initial state of the selection of the parent component (ComposerWithSuggestions) to 0. App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Line 302 in 2784712
It's coming from #32168 to fix a safari-only issue, so we need to handle the selection manually, but the safari issue is already fixed and the workaround is removed in #40295.
Oh, you're right. I found that the |
HI @bernhardoj, do you mind updating your proposal with this approach to clarify what you mean? (you can put it as an alternative solution). Thank you. |
PR is ready cc: @hoangzinh |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-07-24. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Have another 'cursor position isn't in right place issue`. If it's related to this or, or if this might fix it, plz comment on the issue |
@mallenexpensify I don't think it's related because the components being used are different (the PR for this issue is already merged too) |
Payment Summary:
@hoangzinh please complete the checklist. |
Requested in ND. |
$250 approved for @bernhardoj |
Regression Test Proposal
Do we agree 👍 or 👎 |
BugZero Checklist:
|
|
I posted the Regression Test Proposal here #44259 (comment) |
Test case created |
Hey folks! I came from this PR as I was mentioned here. I tested this before the fix on dev(and also on staging, but today, it potentially already has those changes) and noticed that the focus was at the end of the text input. |
Hi @perunt, It's an interesting idea for me. But I'm unsure if we will prioritize it right now. I think you can post it in Slack as a feature request to collect opinions. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.1-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: https://expensify.testrail.io/index.php?/tests/view/4661747&group_by=cases:section_id&group_order=asc&group_id=296775
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Cursor Position Should Not Resets to Start of Message on Page Refresh
Actual Result:
Cursor Position Resets to Start of Message on Page Refresh
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6522559_1719208729219.2024-06-24_10-56-46.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @hoangzinhThe text was updated successfully, but these errors were encountered: