You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Composer - Composer box is refocused when Copying Link on Web and Desktop #45204
Version Number: 9.0.6-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: N/A Email or phone of affected tester (no customers):applausetester+en@applause.expensifail.com Issue reported by: Applause - Internal Team
@lschurr 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
changed the title [-]Composer - Composer box is not refocused when Copying Link[/-][+][$250] Composer - Composer box is not refocused when Copying Link[/+]on Jul 10, 2024
I'm the author of #44399. That's our bad not to note a precondition for the composer to automatically refocus: it must already be focused before interacting with the context menu. So this is not a valid bug considering the current expectations. We can still change the expectations but should note that this is not a regression. Thanks.
When we click on the copy link, we call ReportActionComposeFocusManager.focus function to focus on the composer. The difference here is willBlurTextInputOnTapOutside is false in the native platform and true in other platforms and shouldFocusForNonBlurInputOnTapOutside is false by default so the composer is always re-focused on web/desktop and not re-focused on native
What changes do you think we should make in order to solve the problem?
We should keep track the composer is focused or not when we open the context menu. Then we pass it as payload data when we open the context menu.
In ReportActionComposeFocusManager, create a new variable to keep track of the time the composer is blurred. And create a function to check this. We have a check time - (composerBluredTime ?? 0) <= 100 because when we open the context menu, the composer is blurred and then the context menu is opened immediately.
let composerBluredTime: number | null = null;
function blur() {
composerBluredTime = new Date().getTime();
}
function isJustBlured(time: number) {
return time - (composerBluredTime ?? 0) <= 100;
}
Calling ReportActionComposeFocusManager.blur() here when the composer is blurred
Pass isComposerFocused param as ReportActionComposeFocusManager.isJustBlured(new Date().getTime()) || ReportActionComposeFocusManager.isFocused() when we open the context menu here.
Activity
melvin-bot commentedon Jul 10, 2024
Triggered auto assignment to @lschurr (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.lanitochka17 commentedon Jul 10, 2024
@lschurr 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
lanitochka17 commentedon Jul 10, 2024
We think that this bug might be related to #vip-vsb
[-]Composer - Composer box is not refocused when Copying Link[/-][+][$250] Composer - Composer box is not refocused when Copying Link[/+]melvin-bot commentedon Jul 10, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01a3374b61f565b9cf
melvin-bot commentedon Jul 10, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (
External)gijoe0295 commentedon Jul 10, 2024
I'm the author of #44399. That's our bad not to note a precondition for the composer to automatically refocus: it must already be focused before interacting with the context menu. So this is not a valid bug considering the current expectations. We can still change the expectations but should note that this is not a regression. Thanks.
nkdengineer commentedon Jul 11, 2024
Edited by proposal-police: This proposal was edited at 2024-08-05 18:25:46 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The composer is NOT refocused
What is the root cause of that problem?
When a report is focused, we set the composer focus callback with
shouldFocusForNonBlurInputOnTapOutsideasfalseby defaultApp/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 589 to 591 in a19ef98
When we click on the copy link, we call
ReportActionComposeFocusManager.focusfunction to focus on the composer. The difference here iswillBlurTextInputOnTapOutsideisfalsein the native platform andtruein other platforms andshouldFocusForNonBlurInputOnTapOutsideisfalseby default so the composer is always re-focused on web/desktop and not re-focused on nativeApp/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Line 454 in a19ef98
What changes do you think we should make in order to solve the problem?
We should keep track the composer is focused or not when we open the context menu. Then we pass it as payload data when we open the context menu.
ReportActionComposeFocusManager, create a new variable to keep track of the time the composer is blurred. And create a function to check this. We have a checktime - (composerBluredTime ?? 0) <= 100because when we open the context menu, the composer is blurred and then the context menu is opened immediately.ReportActionComposeFocusManager.blur()here when the composer is blurredApp/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx
Line 308 in 98d8a5a
isComposerFocusedhereApp/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
Line 121 in 98d8a5a
App/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
Line 151 in 98d8a5a
PopoverReportActionContextMenu, get this param here and pass it toBaseReportActionContextMenuApp/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx
Line 173 in 98d8a5a
isComposerFocusedas a payload data hereApp/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Line 244 in 98d8a5a
isComposerFocusedparam asReportActionComposeFocusManager.isJustBlured(new Date().getTime()) || ReportActionComposeFocusManager.isFocused()when we open the context menu here.App/src/pages/home/report/ReportActionItem.tsx
Line 365 in 98d8a5a
isComposerFocusedhere and check if it's true we willApp/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Line 454 in 98d8a5a
The test branch here https://github.com/nkdengineer/App/tree/fix/45204
What alternative solutions did you explore? (Optional)
If we want to not focus on the composer after we select the context menu action in mWeb, we can add
shouldFocusInputOnScreenFocuscheck here.App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 589 to 591 in a19ef98
shouldFocusInputOnScreenFocusis used to consistent the focus behavior mWeb and native so we can use thisApp/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 206 to 208 in 5af66e0
situchan commentedon Jul 12, 2024
So the expected behavior is to refocus always on all platforms regardless of pre-focus status?
104 remaining items
melvin-bot commentedon Sep 18, 2024
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Sep 25, 2024
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Sep 27, 2024
@lschurr, @srikarparsi, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
lschurr commentedon Oct 1, 2024
I'm OOO until next week - Did we come to a decision about this one @srikarparsi?
melvin-bot commentedon Oct 1, 2024
@lschurr, @srikarparsi, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
srikarparsi commentedon Oct 1, 2024
Just followed up in the thread
melvin-bot commentedon Oct 2, 2024
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Oct 3, 2024
@lschurr, @srikarparsi, @situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
mallenexpensify commentedon Oct 3, 2024
Closing, as we closed #vib-vsb, this is an edge case bug and not a near-term priority.