feat: prevent page navigation when user select text (#203)
parent
f72dd01ce7
commit
c5afa9d579
|
@ -24,7 +24,8 @@ const router = useRouter()
|
||||||
function onclick(evt: MouseEvent | KeyboardEvent) {
|
function onclick(evt: MouseEvent | KeyboardEvent) {
|
||||||
const path = evt.composedPath() as HTMLElement[]
|
const path = evt.composedPath() as HTMLElement[]
|
||||||
const el = path.find(el => ['A', 'BUTTON', 'IMG', 'VIDEO'].includes(el.tagName?.toUpperCase()))
|
const el = path.find(el => ['A', 'BUTTON', 'IMG', 'VIDEO'].includes(el.tagName?.toUpperCase()))
|
||||||
if (!el)
|
const text = window.getSelection()?.toString()
|
||||||
|
if (!el && !text)
|
||||||
go(evt)
|
go(evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue