-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Changes from all commits
7597ba7
14e6623
45ed4c9
22b28dd
43d6d8c
a12f442
546ab06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,17 @@ | ||||
import type {NavigationState} from '@react-navigation/native'; | ||||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. No we couldn't. I'm not sure why the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||
const lastRoute = state?.routes?.at(-1); | ||||
if (!lastRoute) { | ||||
return false; | ||||
} | ||||
const params = lastRoute.params; | ||||
if (params && 'screen' in params && typeof params.screen === 'string' && params.screen === SCREENS.RIGHT_MODAL.SEARCH_REPORT) { | ||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. The Reference: App/src/libs/Navigation/linkTo/index.ts Line 71 in 6f22937
|
||||
|
||||
export default isReportOpenInRHP; |
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
Pressable
within aReportActionItem
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 thePressable
right after.This doesn't happen when you right click the
ReportActionItem
background thanks to thewithoutFocusOnSecondaryInteraction
prop.App/src/pages/home/report/ReportActionItem.tsx
Line 874 in 6f22937
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