Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
4.03k stars 3.03k forks source link

Prevent autofocus/refocus on small screen on the report page #56396

Open bernhardoj opened 1 week ago

bernhardoj commented 1 week ago

Explanation of Change

Fixed Issues

$ https://github.com/Expensify/App/issues/55485 PROPOSAL: https://github.com/Expensify/App/issues/55485#issuecomment-2603817017

Tests

Same as QA Steps

Offline tests

Same as QA Steps

QA Steps

Prerequisite: have a workspace chat with unsettled expense

  1. Open the expense thread chat
  2. Verify the composer is (web/desktop) focused / (iOS, Android, mWeb) not focused
  3. Edit anything from the money request
  4. Verify the composer is (web/desktop) focused / (iOS, Android, mWeb) not focused
  5. Go back
  6. Verify the composer is (web/desktop) focused / (iOS, Android, mWeb) not focused

NOTE: This PR changes the autofocus behavior of composer. Mobile screen won't have autofocus anymore.

PR Author Checklist

Screenshots/Videos

Android: Native https://github.com/user-attachments/assets/4f4d3531-04b8-4df3-bcfd-d4b9c852a4f7
Android: mWeb Chrome https://github.com/user-attachments/assets/f26c2ca4-1c77-4553-991d-e79240690f8b
iOS: Native https://github.com/user-attachments/assets/99cfad69-062f-4d14-b0e3-bc00adcbc9f9
iOS: mWeb Safari https://github.com/user-attachments/assets/a1bc8d8a-e0bf-46ba-9582-0f14c229a049
MacOS: Chrome / Safari https://github.com/user-attachments/assets/194b5473-6c83-46e5-9253-f0460f80f312
MacOS: Desktop https://github.com/user-attachments/assets/d31375a1-e0ee-47c7-b291-fc36bca092b4
melvin-bot[bot] commented 1 week ago

@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

jayeshmangwani commented 1 week ago

Reviewer Checklist

Screenshots/Videos

Android: Native https://github.com/user-attachments/assets/cb7727c8-da98-499c-95c8-bc79fb14532c
Android: mWeb Chrome https://github.com/user-attachments/assets/329d2c6d-72fc-4c4b-a0e6-7e2576e5f90c
iOS: Native https://github.com/user-attachments/assets/93ac3bbe-c7e7-48ed-96a1-d286ac9585b1
iOS: mWeb Safari https://github.com/user-attachments/assets/ccc3f8ec-2a38-4a43-94cb-6e19788fad36
MacOS: Chrome / Safari https://github.com/user-attachments/assets/36686b7d-9fe0-4352-86a9-ef7d271cb63b
MacOS: Desktop https://github.com/user-attachments/assets/a44266ab-2762-44d5-b65a-96ad422f9555
jayeshmangwani commented 1 week ago

@bernhardoj, can we please update the QA step and add a note that after this PR, we are updating all cases where the composer for mobile devices should not be auto-focused? I believe some TestRail tests expect the input to auto-focus on mobile devices, which may lead to deployment blockers.

bernhardoj commented 1 week ago

Done.

Btw, can we hold until https://github.com/Expensify/App/issues/56358 is solved? That issue is only reproducible when the composer is refocused after sending a password-protected PDF. This PR hasn't fixed the refocus behavior when sending attachment yet. After that issue is fixed, I'll try to fix the refocus behavior after sending an attachment.

bernhardoj commented 4 days ago

While waiting for the other PR, I tried to find the root cause of why the composer was focused after sending an attachment. This is because we focus on the composer every time the app comes from the background.

https://github.com/Expensify/App/blob/5ddef34fc3c17fa420884efa3a24f574b57a9505/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx#L741-L748

In our case, when selecting an attachment, the app goes to the background, and when we back to the app, the app goes to the foreground (active) again.

Do we want to keep this behavior?

https://github.com/user-attachments/assets/f72567dc-a470-490b-8d8d-5b964e56b734

jayeshmangwani commented 3 days ago

Do we want to keep this behavior?

IMHO, composer shouldn't be the focus, but I'll defer to @shawnborton and @marcochavezf.

jayeshmangwani commented 3 days ago

While waiting for the other PR

Thanks for the update! I'll re-review this PR once the other PR is merged.

shawnborton commented 3 days ago

Agree, we shouldn't auto focus for the user there.