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

[$1000] [HOLD for payment 2023-02-08] mWeb/Chrome - Focus is lost and the keyboard does not reopen after pressing "+" button #13443

Closed
kavimuru opened this issue Dec 8, 2022 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Dec 8, 2022

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:

  1. Go to URL https://staging.new.expensify.com/

  2. Login with any account

  3. Go to any chat

  4. Focus in the input field

  5. Click on "+" button

Expected Result:

The focus is not lost, and the keyboard opens again

Actual Result:

Focus is lost and the keyboard does not reopen

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Mobile Web

Version Number: 1.2.37-2
Reproducible in staging?: y
Reproducible in production?: y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Bug5854946_Record_2022-12-08-18-23-18.mp4

Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e1c94921fb1cc24b
  • Upwork Job ID: 1623468033919070208
  • Last Price Increase: 2023-02-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 8, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 8, 2022

Triggered auto assignment to @michaelhaxhiu (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@bondydaa
Copy link
Contributor

bondydaa commented Dec 9, 2022

Okay after looking into this it does seem like this is only happening on mobile web. Web, iOS, Android all properly give focus back to the composer input after closing this modal.

I've chased it down I think to something with detecting if touch/focus exists here:

this.shouldFocusInputOnScreenFocus = canFocusInputOnScreenFocus();

Because we have native file src/libs/canFocusInputOnScreenFocus/index.native.js for the counter-part src/libs/canFocusInputOnScreenFocus/index.js

So it could be something within src/libs/canUseTouchscreen/index.js that causes the Web src/libs/canFocusInputOnScreenFocus/index.js to do something strange and not give focus back.

I ran out of time today with trying to confirm the value of what canFocusInputOnScreenFocus on my phone b/c of local dev headaches so I'll pick it back up on Monday.

@melvin-bot melvin-bot bot added the Overdue label Dec 12, 2022
@bondydaa
Copy link
Contributor

got stuck fighting with my VM yesterday, will finish off investigation today. dropping this to weekly since I don't think it's a major issue.

@melvin-bot melvin-bot bot removed the Overdue label Dec 13, 2022
@bondydaa bondydaa added Weekly KSv2 and removed Daily KSv2 labels Dec 13, 2022
@bondydaa
Copy link
Contributor

okay yep figured this out.

Using this diff

diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js
index 7811d1c25e..082aba68a1 100644
--- a/src/pages/home/report/ReportActionCompose.js
+++ b/src/pages/home/report/ReportActionCompose.js
@@ -153,6 +153,8 @@ class ReportActionCompose extends React.Component {
     }

     componentDidMount() {
+        const thing = this.shouldFocusInputOnScreenFocus ? 'yes' : 'no';
+        console.log('bondydaa ' + thing);
         ReportActionComposeFocusManager.onComposerFocus(() => {
             if (!this.shouldFocusInputOnScreenFocus || !this.props.isFocused) {
                 return;
(END)

To just console log the value of this.shouldFocusInputOnScreenFocus we can see that in a non-mobile web browser that variable is true
image

But on mobile safari that is false
image

And for sake of completeness iOS app show false as well
image

After adding more logs I can tell that this logic is what is making it so that non-mobile web gets the focus back on the input https://github.com/Expensify/App/blob/1c60740ac8/src/pages/home/report/ReportActionCompose.js#L176-L179

that isn't triggered on the iOS app so the app must have some native code somewhere controlling this and is why we get the difference in behavior but I'm pretty confused.

looks like @parasharrajat did both #2022 and #4687 so do you have any insights here?

@kidroca
Copy link
Contributor

kidroca commented Dec 15, 2022

IMO there's no BUG here

I remember this behavior was discussed extensively in multiple tickets in GH (year ago) and (I think) taken and resolved internally

AFAIK It was decided to

  • restore focus to input for devices with hardware keyboard - laptops/desktops
  • don't restore focus to input to prevent showing the software keyboard - it was considered unwanted user experience

Since mobile web is a case using software keyboard the expected behavior would be not to display the software keyboard after closing a popup

The case with the Emoji picker is an exception as that's tied to composing a message, therefore interacting with it moves focus back to the composer

With the (+) button users are typically moving away from composing long enough to warrant NOT expanding the keyboard automatically

@bondydaa
Copy link
Contributor

Forgot to link the slack thread we started but here where I summarized what we've discussed https://expensify.slack.com/archives/C01GTK53T8Q/p1671127362759299?thread_ts=1671056016.060879&cid=C01GTK53T8Q will post a summary once I make sure we're all on the same page - I think we are but just want to double check 😅

@bondydaa
Copy link
Contributor

The summary of that thread is that I think we need to take this back to the product team and come to an agreement on how we want the app to handle giving focus to/from various modals, composer component, and keyboards.

I think we kind of got to this state b/c we sort of just went with something the last time we had this discussion so hopefully we can make a decision holistically and then clean up the composer component UX and code with that guidance.

@melvin-bot melvin-bot bot added the Overdue label Dec 26, 2022
@bondydaa
Copy link
Contributor

was OOO last week and only on for IFR shifts this week, will kick off discussions in product about this after the new year.

@melvin-bot melvin-bot bot removed the Overdue label Dec 26, 2022
@JmillsExpensify JmillsExpensify self-assigned this Dec 28, 2022
@JmillsExpensify
Copy link

Heads up, this issue will prevent us hitting WAQ starting the second week of January. While I'm hopeful that we can achieve WAQ for the first time next week, that's ultimately just a hope. It'd be good to kick this problem/solution off as soon as you're back from OOO.

@JmillsExpensify
Copy link

Also I went ahead and proactively assigned myself as BZ as we'll like have C+ review of the eventual PR.

@JmillsExpensify JmillsExpensify added Daily KSv2 and removed Weekly KSv2 labels Dec 28, 2022
@JmillsExpensify
Copy link

Also realized that this issue should be daily with the 30 day threshold creeping up on us.

@melvin-bot melvin-bot bot added the Overdue label Jan 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 3, 2023

@JmillsExpensify, @bondydaa Eep! 4 days overdue now. Issues have feelings too...

@bondydaa
Copy link
Contributor

bondydaa commented Jan 3, 2023

okay I've asked in #product here about this https://expensify.slack.com/archives/C03U7DCU4/p1672788774056869

@melvin-bot melvin-bot bot removed the Overdue label Jan 3, 2023
@melvin-bot melvin-bot bot changed the title mWeb/Chrome - Focus is lost and the keyboard does not reopen after pressing "+" button [HOLD for payment 2023-02-08] mWeb/Chrome - Focus is lost and the keyboard does not reopen after pressing "+" button Feb 1, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Feb 1, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Feb 1, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.63-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 2023-02-08. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Feb 1, 2023

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:

  • [@bondydaa] The PR that introduced the bug has been identified. Link to the PR:
  • [@bondydaa] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@bondydaa] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@bondydaa] Propose regression test steps to ensure the same bug will not reach production again.
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Feb 8, 2023
@bondydaa
Copy link
Contributor

bondydaa commented Feb 8, 2023

I don't think there is a single PR that added this, I think there was a slow build up of a few PRs from over a year ago so I'm not sure there are any additional regression tests or anything needed.

Ultimately the hope is we can refactor the compose focus logic a bit to be more streamlined and if/when we do that then we'll be sure to include updated testing steps.

@melvin-bot melvin-bot bot removed the Overdue label Feb 8, 2023
@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Feb 8, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-02-08] mWeb/Chrome - Focus is lost and the keyboard does not reopen after pressing "+" button [$1000] [HOLD for payment 2023-02-08] mWeb/Chrome - Focus is lost and the keyboard does not reopen after pressing "+" button Feb 8, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @JmillsExpensify is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

Current assignee @eVoloshchak is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 8, 2023
@MelvinBot
Copy link

Current assignee @bondydaa is eligible for the External assigner, not assigning anyone new.

@JmillsExpensify
Copy link

Looking at the linked PR, looks like @eVoloshchak helped so I'm added external and triggering an Upwork job.

@JmillsExpensify JmillsExpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 8, 2023
@JmillsExpensify
Copy link

Let me know when you've applied to the job above and we can get the payment for C+ PR review squared away!

@JmillsExpensify
Copy link

As for the regression test, we have an existing test for focus in the creation flow, so I think we're good on this consideration. Checking that item off the list.

@eVoloshchak
Copy link
Contributor

@JmillsExpensify, applied!

@JmillsExpensify
Copy link

Offer sent!

@JmillsExpensify
Copy link

Paid out via Upwork, closing this one out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants