-
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
[HOLD for payment 2024-08-29] [$250] Composer box- position cursor jumps to begining of message when copying as link #46095
Comments
Triggered auto assignment to @mallenexpensify ( |
We think this issue might be related to the #vip-vsb |
Edited by proposal-police: This proposal was edited at 2024-08-06 14:20:45 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.The cursor position of the composer go to the start after selecting option from the context menu. What is the root cause of that problem?When we select an option from the context menu such as copy link, we will refocus to the composer.
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 589 to 595 in bf69d5d
App/src/components/Composer/index.tsx Lines 376 to 386 in bf69d5d
I don't have the context on why we have 2 When the composer (live markdown input) is focused, it will trigger However, in our case, focusing after closing the context menu doesn't trigger the What changes do you think we should make in order to solve the problem?We need to wait for the modal to completely hidden before focusing the composer. If the modal is completely hidden, the children will be unmounted including the focus trap too, so it's guaranteed the focus trap is gone. To do that, we need to focus to the composer using App/src/libs/focusComposerWithDelay/index.ts Lines 30 to 34 in bf69d5d
App/src/components/Modal/BaseModal.tsx Line 232 in bf69d5d
App/src/components/Modal/BaseModal.tsx Lines 145 to 147 in bf69d5d
However, in strict mode, the
ModalContent.tsx
This will fix the issue when we previously focus on the composer, open the context menu, and select copy link. However, it's still broken if we open the chat without focusing on the composer, open the context menu, and select copy link. As I mentioned in my proposal, the cursor position is set based on the selection value. The main composer initial selection value is 0, so without ever focusing on the composer, selecting copy link from the context menu will still put the cursor at the start. To fix it, we need to set the initial selection to the value length. App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Line 301 in bf69d5d
|
Job added to Upwork: https://www.upwork.com/jobs/~01dc75491f30967e9c |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @c3024 ( |
@c3024 , can you attempt reproduction? I just tried on Safari, iOS, with no luck. If you're able to , can you review @bernhardoj 's proposal? |
Added to #vip-vsb, this is a small bug and a bit of an edge case. @bernhardoj , do you know if this bug exists elsewhere? Or if this fix would help other instances? |
@mallenexpensify there are 2 fixes in my proposal. The first fix is specific to refocusing logic after selecting an item from the context menu (copy link, mark as unread, etc.). The second one fixes the composer initial selection value which is a broader fix, but I'm not aware of any issue that needs the same fix. |
I could reproduce this. I will update on the proposal. |
Is this an issue with |
Yes, it's a problem we are facing in #23959 too and in my proposal there, I already fix it on the rn-web, but stuck on native. |
@bernhardoj @c3024 , what do you propose is the best next step here? I added |
I think we are waiting for @c3024 review |
How can we select copy link from a comment without ever focusing on the composer? When we open a report the composer gets automatically focused, right? |
This only happens if the chat is empty (on small screen). |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
On Desktop Web, even for smaller screens, I see composer gets focused for all cases including the case when there is a comment in the report. Here, focusing composer with delay fix is enough. cursor.mp4But for mWeb Safari, I see this
but this is not fixed even after making both the changes. cursormWeb.mp4 |
By small screen, I mean the mobile device.
I just tested and you're right. When I turned off the strict mode, then it works. From my finding, because of the strict mode, when the modal becomes visible, the App/src/components/Modal/BaseModal.tsx Line 258 in 41e27c9
App/src/components/Modal/ModalContent.tsx Lines 16 to 19 in 41e27c9
App/src/components/Modal/BaseModal.tsx Lines 145 to 148 in 41e27c9
Because of that, |
📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
@bernhardoj 's proposal looks good to me 👍🏼 |
There is another case I found in which the issue is still happening and the focus doesn't wait until the modal is closed (even with setTimeout). I'll continue the investigation and open the PR tomorrow. |
PR is ready cc: @c3024 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.23-0 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-08-29. 🎊 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:
|
Contributor: @bernhardoj due $250 via NewDot @c3024 plz complete the BZ checklist. thx |
Requested in ND. |
Regression test proposal
|
$250 approved for @bernhardoj |
Thanks @c3024 , test case created |
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: v9.0.11-2
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): negasofonias+7241@gmail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team
Action Performed:
Expected Result:
Position cursor should stay at the end of the message being typed
Actual Result:
Position cursor jumps to the front of the content being typed
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6550361_1721724352651.Screen_Recording_20240723_113515.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @c3024The text was updated successfully, but these errors were encountered: