-
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
feat: blur the composer focus when open context menu #47621
Changes from 1 commit
c66dd94
9dd2342
80bd82e
dec716c
5c0ebae
bd065ee
edb8fb2
6b686ba
2cf341b
56499bc
de12e1a
3ab551c
b19ef5c
21d0f80
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 |
---|---|---|
|
@@ -167,6 +167,20 @@ function ReportActionItemMessageEdit( | |
}; | ||
}, []); | ||
|
||
useEffect( | ||
// Remove focus callback on unmount to avoid stale callbacks | ||
() => { | ||
if (textInputRef.current) { | ||
ReportActionComposeFocusManager.editComposerRef.current = textInputRef.current; | ||
} | ||
return () => { | ||
ReportActionComposeFocusManager.editComposerRef.current = null; | ||
ReportActionComposeFocusManager.clear(true); | ||
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.
47621-clear-issue-1.mp4There 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. Here's the result after refactoring Screen.Recording.2024-10-01.at.11.21.52.mov |
||
}; | ||
}, | ||
[], | ||
); | ||
|
||
// We consider the report action active if it's focused, its emoji picker is open or its context menu is open | ||
const isActive = useCallback( | ||
() => isFocusedRef.current || EmojiPickerAction.isActive(action.reportActionID) || ReportActionContextMenu.isActiveReportAction(action.reportActionID), | ||
|
@@ -516,9 +530,6 @@ function ReportActionItemMessageEdit( | |
style={[styles.textInputCompose, styles.flex1, styles.bgTransparent]} | ||
onFocus={() => { | ||
setIsFocused(true); | ||
if (textInputRef.current) { | ||
ReportActionComposeFocusManager.editComposerRef.current = textInputRef.current; | ||
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. I am not sure why we removed this as I think we need to set the 47621-focus-issue-1.mp4 |
||
} | ||
InteractionManager.runAfterInteractions(() => { | ||
requestAnimationFrame(() => { | ||
reportScrollManager.scrollToIndex(index, true); | ||
|
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.
As mentioned here already, we just had to reset the
editComposerRef
when isPriorityCallback is true because we call clear(true) inReportActionItemMessageEdit
here. Can we move the code to reset theeditComposerRef
to within ReportActionComposeFocusManager:clear?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.
Yes, we can. I'll update soon
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.
@rojiphil I updated