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

[$250] Composer - Composer box is refocused when Copying Link on Web and Desktop #45204

Closed
3 of 6 tasks
lanitochka17 opened this issue Jul 10, 2024 · 97 comments
Closed
3 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 10, 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: 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

Issue found when executing PR #44399

Action Performed:

  1. Right click on a message (in web or desktop)
  2. Select copy to clipboard

Expected Result:

User doesn't expect the composer to get refocused.

Actual Result:

Composer gets refocussed: Expected chart

Workaround:

Unknown

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

Bug6538235_1720636352340.Composer_is_not_refocused.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a3374b61f565b9cf
  • Upwork Job ID: 1811154850298352037
  • Last Price Increase: 2024-10-02
Issue OwnerCurrent Issue Owner: @situchan
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 10, 2024
Copy link

melvin-bot bot commented 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
Copy link
Author

@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
Copy link
Author

We think that this bug might be related to #vip-vsb

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Jul 10, 2024
@melvin-bot melvin-bot bot changed the title Composer - Composer box is not refocused when Copying Link [$250] Composer - Composer box is not refocused when Copying Link Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

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

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

melvin-bot bot commented Jul 10, 2024

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

@gijoe0295
Copy link
Contributor

gijoe0295 commented 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
Copy link
Contributor

nkdengineer commented 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 shouldFocusForNonBlurInputOnTapOutside as false by default

ReportActionComposeFocusManager.onComposerFocus((shouldFocusForNonBlurInputOnTapOutside = false) => {
if ((!willBlurTextInputOnTapOutside && !shouldFocusForNonBlurInputOnTapOutside) || !isFocused) {
return;

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

hideContextMenu(true, ReportActionComposeFocusManager.focus);

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.

  1. 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;
}
  1. Calling ReportActionComposeFocusManager.blur() here when the composer is blurred
ReportActionComposeFocusManager.blur()

  1. Add an extra param isComposerFocused here
isComposerFocused = false,

  1. In PopoverReportActionContextMenu, get this param here and pass it to BaseReportActionContextMenu

  1. Pass isComposerFocused as a payload data here

const payload: ContextMenuActionPayload = {

  1. Pass isComposerFocused param as ReportActionComposeFocusManager.isJustBlured(new Date().getTime()) || ReportActionComposeFocusManager.isFocused() when we open the context menu here.
false,
ReportActionComposeFocusManager.isJustBlured(new Date().getTime()) || ReportActionComposeFocusManager.isFocused(),

setIsEmojiPickerActive as () => void,

  1. Get isComposerFocused here and check if it's true we will
hideContextMenu(true, () => {
    if (!isComposerFocused) {
        return;
    }
    ReportActionComposeFocusManager.focus(true);
});

onPress: (closePopover, {reportAction, reportID}) => {

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 shouldFocusInputOnScreenFocus check here.

if ((!willBlurTextInputOnTapOutside && !shouldFocusForNonBlurInputOnTapOutside && !shouldFocusInputOnScreenFocus) || !isFocused) {
    return;
}

ReportActionComposeFocusManager.onComposerFocus((shouldFocusForNonBlurInputOnTapOutside = false) => {
if ((!willBlurTextInputOnTapOutside && !shouldFocusForNonBlurInputOnTapOutside) || !isFocused) {
return;

shouldFocusInputOnScreenFocus is used to consistent the focus behavior mWeb and native so we can use this

// We want consistent auto focus behavior on input between native and mWeb so we have some auto focus management code that will
// prevent auto focus on existing chat for mobile device
const shouldFocusInputOnScreenFocus = canFocusInputOnScreenFocus();

@situchan
Copy link
Contributor

Platform Focused before menu Focused after copying link (before fix) Focused after copying link (after fix)
Web
Web
mSafari
mSafari
mChrome
mChrome
iOS
iOS ❌ (bug to fix)
Android ✅ (but no keyboard popup)
Android ❌ (bug to fix)

So the expected behavior is to refocus always on all platforms regardless of pre-focus status?

@nkdengineer
Copy link
Contributor

So the expected behavior is to refocus always on all platforms regardless of pre-focus status?

I think it's expected.

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
@lschurr
Copy link
Contributor

lschurr commented Jul 15, 2024

Any update @situchan? Are we saying this is expected and not a bug?

Copy link

melvin-bot bot commented Jul 15, 2024

@lschurr, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@situchan
Copy link
Contributor

Any update @situchan? Are we saying this is expected and not a bug?

I am saying this is not worth fixing.

@Expensify/design what do you think of #45204 (comment)?

@melvin-bot melvin-bot bot removed the Overdue label Jul 16, 2024
@shawnborton
Copy link
Contributor

Hmm interesting one for sure. My first reaction is that I don't think I would expect the composer to be refocused after using the Copy link menu item. The user is basically electing to tap outside of the composer box... so I don't think we should assume that they want to head back into the composer box immediately after interacting with a different part of the app. Curious what Danny and Jon think though!

@shawnborton
Copy link
Contributor

At the same time, if we only have two places (iOS and Android) where we aren't doing this behavior, I can see where it makes sense to make everything consistent so we have the same exact behavior on all platforms.

@dannymcclain
Copy link
Contributor

My first reaction is that I don't think I would expect the composer to be refocused after using the Copy link menu item. The user is basically electing to tap outside of the composer box... so I don't think we should assume that they want to head back into the composer box immediately after interacting with a different part of the app.

Totally agree with this 100%.

At the same time, if we only have two places (iOS and Android) where we aren't doing this behavior, I can see where it makes sense to make everything consistent so we have the same exact behavior on all platforms.

Personally I think it makes more sense to not refocus the input on any platform after an action like this... but that might just be my personal preference :run-away:.

On mobile, the keyboard takes up so much space and sometimes it can be hard to remove focus from the composer (and get the keyboard to go away). And trying to browse a conversation with the keyboard up is pretty frustrating. So I think I would still prefer not auto-focusing the composer. Just :my-two-cents:.

@situchan
Copy link
Contributor

Thanks for the feedback.
Looks like we wanna focus only on web / desktop, not focus on all mobile platforms (iOS, android, mWeb) for consistency.

Platform Focused before menu Focused after copying link (before fix) Focused after copying link (after fix)
Web
Web
mSafari
mSafari ✅ (bug to fix)
mChrome
mChrome ✅ (bug to fix)
iOS
iOS
Android ✅ (but no keyboard popup)
Android

@dubielzyk-expensify
Copy link
Contributor

I'm with Danny on this one. I don't think it makes that much sense to do on mobile due to the keyboard popping up. On desktop you got two input methods (keyboard and mouse) and focusing the composer doesn't break any flow or require a dismissal so that's fine for me. But on mobile, I just think it'd be more disruptive

@nkdengineer
Copy link
Contributor

Updated proposal #45204 (comment) with new expected behavior.

@shawnborton
Copy link
Contributor

Cool cool, thanks to you both for your thoughts - I like where you landed.

Copy link

melvin-bot bot commented Jul 17, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@lschurr
Copy link
Contributor

lschurr commented Sep 4, 2024

Still looking for proposals

Copy link

melvin-bot bot commented Sep 4, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@situchan
Copy link
Contributor

situchan commented Sep 4, 2024

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Sep 4, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added the Overdue label Sep 9, 2024
@lschurr
Copy link
Contributor

lschurr commented Sep 9, 2024

Hey @situchan - Are you able to reproduce this one still?

Copy link

melvin-bot bot commented Sep 10, 2024

@lschurr, @srikarparsi, @situchan Eep! 4 days overdue now. Issues have feelings too...

@situchan
Copy link
Contributor

OP is outdated. This is final expected behavior.

@melvin-bot melvin-bot bot removed the Overdue label Sep 10, 2024
@situchan
Copy link
Contributor

still reproducible on v9.0.31-22

web.mp4

Copy link

melvin-bot bot commented Sep 11, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

@melvin-bot melvin-bot bot added the Overdue label Sep 13, 2024
@situchan
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Sep 16, 2024
Copy link

melvin-bot bot commented 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 melvin-bot bot added Overdue and removed Overdue labels Sep 18, 2024
Copy link

melvin-bot bot commented 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? 💸

Copy link

melvin-bot bot commented Sep 27, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Sep 27, 2024
@lschurr
Copy link
Contributor

lschurr commented Oct 1, 2024

I'm OOO until next week - Did we come to a decision about this one @srikarparsi?

Copy link

melvin-bot bot commented Oct 1, 2024

@lschurr, @srikarparsi, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@srikarparsi
Copy link
Contributor

Just followed up in the thread

Copy link

melvin-bot bot commented 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? 💸

Copy link

melvin-bot bot commented 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
Copy link
Contributor

Closing, as we closed #vib-vsb, this is an edge case bug and not a near-term priority.

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. Daily KSv2 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
Projects
No open projects
Status: No status
Development

No branches or pull requests