@daybrush/drag
Advanced tools
Comparing version 0.18.1 to 0.18.2
{ | ||
"name": "@daybrush/drag", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "You can set up drag events in any browser.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/drag.cjs.js", |
@@ -124,13 +124,22 @@ import { DragOptions, Client, Position, OnDrag } from "./types"; | ||
if (!this.flag && checkInput) { | ||
if (!this.flag) { | ||
const activeElement = document.activeElement as HTMLElement; | ||
const target = e.target as HTMLElement; | ||
const tagName = target.tagName.toLowerCase(); | ||
const hasInput = INPUT_TAGNAMES.indexOf(tagName) > -1; | ||
const hasContentEditable = target.isContentEditable; | ||
if ( | ||
(INPUT_TAGNAMES.indexOf(tagName) > -1 && activeElement === target) | ||
|| (activeElement && target.isContentEditable && activeElement.isContentEditable | ||
&& (activeElement === target || activeElement.contains(target))) | ||
) { | ||
return false; | ||
if (hasInput || hasContentEditable) { | ||
if (checkInput || activeElement === target) { | ||
// force false or already focused. | ||
return false; | ||
} | ||
if ( | ||
activeElement | ||
&& hasContentEditable | ||
&& activeElement.isContentEditable | ||
&& activeElement.contains(target) | ||
) { | ||
return false; | ||
} | ||
} | ||
@@ -137,0 +146,0 @@ } |
216488
2549