fix(core): input focus preventing selection rect
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -3,10 +3,16 @@ import type { KeyFilter, MaybeRef } from '@vueuse/core'
|
||||
import { isBoolean, isFunction } from '@vueuse/core'
|
||||
|
||||
function isInputDOMNode(event: KeyboardEvent): boolean {
|
||||
const target = event.composedPath()[0] as HTMLElement
|
||||
const target = (event.composedPath?.()?.[0] || event.target) as HTMLElement
|
||||
|
||||
// we want to be able to do a multi selection event if we are in an input field
|
||||
if (event.ctrlKey || event.metaKey || event.shiftKey) return false
|
||||
|
||||
const hasAttribute = isFunction(target.hasAttribute) ? target.hasAttribute('contenteditable') : false
|
||||
|
||||
const closest = isFunction(target.closest) ? target.closest('.nokey') : null
|
||||
|
||||
// when an input field is focused we don't want to trigger deletion or movement of nodes
|
||||
return ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || hasAttribute || !!closest
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user