-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
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. |
@@ -12,6 +13,12 @@ function FocusTrapForModal({children, active}: FocusTrapForModalProps) { | |||
clickOutsideDeactivates: true, | |||
initialFocus: false, | |||
fallbackFocus: document.body, | |||
setReturnFocus: (element) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem
- Right press the message sender/report preview/money request preview/task checkbox or any
Pressable
within 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 Pressable
s. 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.
withoutFocusOnSecondaryInteraction |
Solution
If the composer is already focused, we won't allow the focus trap to return focus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
const isReportInRhpOpened = lastRoute?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && lastRoute?.state?.routes?.some((route) => route?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT); |
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the useIsReportOpenInRHP hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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