Skip to content

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

Closed

Description

@kavimuru

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

Activity

  1. added
    Daily
    Bug
    on Dec 8, 2022
  2. melvin-bot commented on Dec 8, 2022

    @melvin-bot

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

  3. bondydaa commented on Dec 9, 2022

    @bondydaa
    Contributor

    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.

  4. bondydaa commented on Dec 13, 2022

    @bondydaa
    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.

  5. added
    Weekly
    and removed
    Daily
    on Dec 13, 2022
  6. bondydaa commented on Dec 13, 2022

    @bondydaa
    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?

  7. kidroca commented on Dec 15, 2022

    @kidroca
    Contributor

    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

  8. bondydaa commented on Dec 15, 2022

    @bondydaa
    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 😅

  9. 42 remaining items

  10. added
    External
    on Feb 8, 2023
  11. 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[/+] on Feb 8, 2023
  12. MelvinBot commented on Feb 8, 2023

    @MelvinBot
    Contributor
  13. MelvinBot commented on Feb 8, 2023

    @MelvinBot
    Contributor

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

  14. MelvinBot commented on Feb 8, 2023

    @MelvinBot
    Contributor

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

  15. added
    Help Wanted
    on Feb 8, 2023
  16. MelvinBot commented on Feb 8, 2023

    @MelvinBot
    Contributor

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

  17. JmillsExpensify commented on Feb 8, 2023

    @JmillsExpensify
    Contributor

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

  18. removed
    Help Wanted
    on Feb 8, 2023
  19. JmillsExpensify commented on Feb 8, 2023

    @JmillsExpensify
    Contributor

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

  20. JmillsExpensify commented on Feb 8, 2023

    @JmillsExpensify
    Contributor

    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.

  21. eVoloshchak commented on Feb 9, 2023

    @eVoloshchak
    Contributor
  22. JmillsExpensify commented on Feb 9, 2023

    @JmillsExpensify
    Contributor

    Offer sent!

  23. JmillsExpensify commented on Feb 9, 2023

    @JmillsExpensify
    Contributor

    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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions