-
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 2023-09-07] [$1000] Web - Composer out focus when the thread has many messages #23886
Comments
Triggered auto assignment to @jliexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
I can somewhat repro this, but not reliably. I did discover an additional issue related to the composer and the Edit function:
|
Job added to Upwork: https://www.upwork.com/jobs/~019d68a31c68ab4865 |
Current assignee @jliexpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Observe that composer is out of focus and switches to focus edit parent message after send many message What is the root cause of that problem?It's here, we're focusing the "edit message" input in first render (and whenever So when the page reloads, or when the message edit input goes out of view and is rerendered again, it will automatically gain focus (even though the This is a regression after the functional component refactor. What changes do you think we should make in order to solve the problem?We can use
aka we only focus the input if the Since this first render logic is used quite commonly now, we can create a dedicated hook for it, for better reuse. What alternative solutions did you explore? (Optional)Another solution is to use
[Update: the below was already fixed] |
@jliexpensify I think it has different solution from this. @tienifr Your solution is working, but the root cause still needs to be fixed. Why does the component need to re-render? My observation led to this code causing it to re-render. If I remove the below code, the composer is not out of focus. App/src/pages/home/report/ReportActionItem.js Lines 614 to 618 in dc32700
|
Contributor details |
📣 @Surojd! 📣
|
Contributor details |
@mollfpr Sorry, to clarify, the issue does not happen when the component re-renders, it happens if the component is unmounted and re-mounted again. In this case, when there're many messages that cause the edited report action to go out of the screen, that report action is unmounted, then when we send another message, the list is re-rendered and the items are mounted again, causing the issue. Also do note that the issue also occurs when reloading the page, so I believe my proposal is the correct fix. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Composer loses focus when an action is in edit mode and the thread has many messages. What is the root cause of that problem?@tienifr and @mollfpr considerations are correct. But IMO, the main problem is an For smallScreenWidths this is done automatically as you can see from the following screenshot. Screen.Recording.2023-08-02.at.09.31.55.movWhat changes do you think we should make in order to solve the problem?I think, composer should be hidden if an action is in edit mode. To do this, the following line App/src/pages/home/report/ReportFooter.js Line 84 in 6a38341
can be changed as: {!hideComposer && props.shouldShowComposeInput && ( What alternative solutions did you explore? (Optional)@tienifr solution |
ProposalPlease re-state the problem that we are trying to solve in this issue.Composer out focus when the thread has many messages What is the root cause of that problem?Here , we are focusing on the "edit message" input, regardless of the draft message's prior value, during the first render (and every time isDraftEmpty changes). Therefore, even though the isDraftEmpty state remains same, the message edit input will automatically gain focus when the page reloads or when it moves out of view and is rendered again. App/src/pages/home/report/ReportActionItem.js Lines 144 to 152 in 6a38341
What changes do you think we should make in order to solve the problem?In order to fix the issue we have to check whether the previous value of draftMessage is undefined or props.draftMessage
Issue Fixed Video:out.focus.when.the.thread.has.many.messages.mp4 |
Not overdue, but bumping @mollfpr to review some proposals! |
@tienifr The focus is passed to the composer at the end, while this issue is the main composer loses the focus. Did I miss something? Screen.Recording.2023-08-04.at.20.40.50.mov
If the I'm following the changes you suggest in your solution, but it's not working. @HLEDYA I think that's intended.
You can open a discussion regarding this. This is not a fix but a suggestion to change our App behavior. @Surojd it's already proposed in the alternative solution on @tienifr proposal. |
@mollfpr That solution is ineffective. I tested the code, investigated every possibility, and discovered the answer. |
@Surojd Sorry, which solution do you mean? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
This solution does not work.
|
@mollfpr I've added the code snippet for that alternate solution of using |
@mollfpr ,
@tienifr's solution
This solution is not working because it is re-rendering the react component when composer out of focus when the thread has many messages. this code runs on re-rendering. In order to fix this issue. In my proposed solution. I have checked prevProps has draftMessage or props.draftMessage is same with prevDraftMessage. Here is my implementation for fix
|
@Surojd In the @tienifr proposal, there are 2 solutions proposed. Using the Let's use the 🎀 👀 🎀 C+ reviewed! |
Triggered auto assignment to @thienlnam, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @mollfpr 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
📣 @namhihi237 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
PR ready for review #24369 |
For visibility, we didn't resolve this bug on mweb/safari because that would require us to add platform specific handling to the code. I've created this issue #26239 to track solving the root cause of the mweb/safari issue. When we solve that, this issue should be resolve for mweb/safari as well |
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.59-5 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 2023-09-07. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External 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:
|
Payment summary:
@mollfpr could you complete the checklist? Thanks! |
https://github.com/Expensify/App/pull/18809/files#r1316713622
I think this can be caught while QA, so adding the regression step should be enough.
|
Everyone paid, job removed! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Composer doesn't lose focus
Actual Result:
Observe that composer is out of focus and switches to focus edit parent message after send many message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.47.3
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
Screen.Recording.2023-07-29.at.13.30.43.mov
Recording.4004.mp4
Expensify/Expensify Issue URL:
Issue reported by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690612204876679
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: