[No QA] Fix autofocus after hiding side panel v2#71788
Conversation
Codecov Report❌ Patch coverage is
... and 72 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@hoangzinh 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-10-21.at.22.54.56.android.movAndroid: mWeb ChromeScreen.Recording.2025-10-21.at.22.50.34.android.chrome.moviOS: HybridAppScreen.Recording.2025-10-21.at.23.05.07.ios.moviOS: mWeb SafariScreen.Recording.2025-10-21.at.22.57.00.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2025-10-21.at.22.45.05.web.movMacOS: DesktopScreen.Recording.2025-10-21.at.22.47.50.desktop.mov |
src/hooks/useAutoFocusInput.ts
Outdated
| // Trigger focus when Side Panel transition ends | ||
| const {isSidePanelTransitionEnded, shouldHideSidePanel} = useSidePanel(); | ||
| const prevShouldHideSidePanel = usePrevious(shouldHideSidePanel); | ||
| const wasSidePanelClosed = useRef(false); |
There was a problem hiding this comment.
Hi @jmusial, does it still work if we use useState here?
| if (getPlatform() === CONST.PLATFORM.ANDROID) { | ||
| onModalHide(); | ||
| } | ||
| onModalHide(); |
There was a problem hiding this comment.
There is a PR, which is reverted here #71568, which has the same approach. Can you check if it also causes the same deploy blocker if we go with this approach?
There was a problem hiding this comment.
Ok there is no clear DB mention but from this comment I assume this was the issue #71542
On IOS with repro steps:
- Open app
- Go to any conversation or workspace chat
- Tap on + button
- Tap on Add attachment
Expected Result:
5. Option list for add attachment should display
Video:
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-10-08.at.11.01.39.mov
There was a problem hiding this comment.
The above bug happened again and caused deploy blocker:
#73169
We should be very careful and do thorough testing as modal is used everywhere throughout the app.
|
hey @hoangzinh will do. Just I got swamped a bit with other (higher prio) tasks. Will try to do it tomorrow. |
|
@hoangzinh Updated the PR description with more detailed issue description |
|
@jmusial do you know how to open sidepanel currently? I tried to trigger |
I'm using this
|
|
Closed and reopened to run the last workflow. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.2.36-0 🚀
|
|
Looks like this caused a regression |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.2.36-7 🚀
|

Explanation of Change
This is a second version of side panel focus fix after a revert of #70097.
[No QA] because help panel is hidden in a way that makes QA testing impossible.
Root cause
Rewriting
useSidePanelinto context exposed underlying issue with flags timing inuseAutofocusInput.The right combination of
shouldHideSidePanel,prevShouldHideSidePanelandisSidePanelTransitionEndedwasn't happening at the same time (Before it was because the default values int the hook).Difference in approach from the previous reverted PR & current
Previous:
prevShouldHideSidePanel, which caused side effects in other parts of the appCurrent:
statethat will 'wait' after side panel is hidden (shouldHideSidePanel === true && prevShouldHideSidePanel === false) till the animation finishes andisSidePanelTransitionEnded === trueonDismisslogic to be consistent across platforms. When testing it proved unreliable in the previous form. I consider this a low risk change since we were only using it internally betweenBaseModalandReanimatedModalFixed Issues
$ #69766
PROPOSAL:
N/A
Tests
Pre requisite:
Account that had side panel enabled before
Revert this PR
Retest of #70625
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
0050.android.native.mov
Android: mWeb Chrome
0050.android.chrome.mov
iOS: Native
0050.ios.native.mov
iOS: mWeb Safari
0050.ios.safari.mov
MacOS: Chrome / Safari
0050.desktop.chrome.mov
MacOS: Desktop
0050.desktop.native.mov