fix: Copying a message with a reply doesn't refocus on the composer#44399
Conversation
|
@rushatgabhane 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] |
|
@gijoe0295 can you please make sure @nkdengineer's points are also addressed and in the test steps |
|
@rushatgabhane Yes I did. They are steps 5 - 10. |
| clickOutsideDeactivates: true, | ||
| initialFocus: false, | ||
| fallbackFocus: document.body, | ||
| setReturnFocus: (element) => { |
There was a problem hiding this comment.
Problem
- Right press the message sender/report preview/money request preview/task checkbox or any
Pressablewithin aReportActionItem - Press any context menu item
- The composer gains focus briefly then loses it
RCA
The context menu activates a focus trap that would return focus to to the element that was previously focused when it unmounts, which can be any of the above Pressables. So when the context menu closes, the composer would gain focus first, then the focus trap moves the focus to the Pressable right after.
This doesn't happen when you right click the ReportActionItem background thanks to the withoutFocusOnSecondaryInteraction prop.
Solution
If the composer is already focused, we won't allow the focus trap to return focus.
| return true; | ||
| } | ||
| return !!(lastRoute.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && lastRoute.state?.routes?.some((route) => route?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT)); | ||
| }; |
There was a problem hiding this comment.
The params check mentioned by the other proposal only solves the issue when we navigate to report RHP from the search expenses page but not when we navigate to this page by direct URL. In the latter case, we should use state.routes check.
Reference:
App/src/libs/Navigation/linkTo/index.ts
Line 71 in 6f22937
|
@gijoe0295 lint check is failing |
| import NAVIGATORS from '@src/NAVIGATORS'; | ||
| import SCREENS from '@src/SCREENS'; | ||
|
|
||
| const isReportOpenInRHP = (state: NavigationState | undefined): boolean => { |
There was a problem hiding this comment.
No we couldn't. I'm not sure why the activeRoute returned by that hook is always RightModalNavigator when used in ReportActionComposeFocusManager but should be Search_Report_RHP instead.
There was a problem hiding this comment.
@WojtekBoman could you check on this please? I'd rather not have two ways of checking if a report is open on RHP
|
Bump @rushatgabhane for review |
|
Bump for review! |
|
reviewing |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-07-09.at.07.15.19.movAndroid: mWeb ChromeiOS: NativeScreen.Recording.2024-07-09.at.07.13.27.moviOS: mWeb SafariUploading Screen Recording 2024-07-09 at 07.20.42.mov… MacOS: Chrome / SafariScreen.Recording.2024-07-09.at.07.10.04.movMacOS: DesktopScreen.Recording.2024-07-09.at.07.08.43.mov |
|
✋ 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/luacmartins in version: 9.0.6-0 🚀
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.6-0 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.0.6-1 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.0.6-1 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.6-8 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.7-8 🚀
|
Details
Context menu actions do not refocus composer for highlighted messages (
r/:reportID/:reportActionID).Fixed Issues
$ #44078
PROPOSAL: #44078 (comment)
Tests
[Web & Desktop only]
Offline tests
NA
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
Android: mWeb Chrome
video_2024-06-26_04-58-56.mp4
video_2024-06-26_04-58-52.mp4
iOS: Native
Screen.Recording.2024-06-26.at.03.36.07-source.mov
iOS: mWeb Safari
Screen.Recording.2024-06-26.at.03.37.48-source.mov
Screen.Recording.2024-06-26.at.04.56.56-source.mov
MacOS: Chrome / Safari
Screen.Recording.2024-06-26.at.03.25.59-source.mov
MacOS: Desktop
Screen.Recording.2024-06-26.at.03.29.44-source.mov