mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
Merge pull request #20887 from overleaf/dp-rp-entry-buttons
Don't focus entry if clicking on a button/link GitOrigin-RevId: 0c37ce76134358ef7d3fd5b0c897ffab8e4d7db1
This commit is contained in:
@@ -43,12 +43,25 @@ export const ReviewPanelEntry: FC<{
|
||||
setReviewPanelOpen(true)
|
||||
}, [setReviewPanelOpen])
|
||||
|
||||
const focusHandler = useCallback(() => {
|
||||
if (selectLineOnFocus) {
|
||||
openDocId(docId, { gotoOffset: position, keepCurrentView: true })
|
||||
}
|
||||
setFocused(true)
|
||||
}, [selectLineOnFocus, docId, openDocId, position])
|
||||
const focusHandler = useCallback(
|
||||
event => {
|
||||
if (
|
||||
event.target instanceof HTMLButtonElement ||
|
||||
event.target instanceof HTMLLinkElement ||
|
||||
event.target instanceof HTMLTextAreaElement
|
||||
) {
|
||||
// Don't focus if the click was on a button/link/textarea as we don't want
|
||||
// affect the behaviour of the button/link/textarea
|
||||
return
|
||||
}
|
||||
|
||||
if (selectLineOnFocus) {
|
||||
openDocId(docId, { gotoOffset: position, keepCurrentView: true })
|
||||
}
|
||||
setFocused(true)
|
||||
},
|
||||
[selectLineOnFocus, docId, openDocId, position]
|
||||
)
|
||||
|
||||
// Clear op highlight on dismount
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user