Skip to content

Commit 47a4f58

Browse files
authored
Update text-selection-active.js
1 parent 2ed8a6e commit 47a4f58

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/table/helpers/text-selection-active.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
// Helper to determine if a there is an active text selection on the document page.
22
// Used to filter out click events caused by the mouse up at end of selection
3+
//
4+
// Accepts an element as only argument to test to see if selection overlaps or is
5+
// contained within the element
6+
7+
import { isELement } from '../../../utils/dom'
38

49
export default function textSelectionActive() {
510
const win = window
611
/* istanbul ignore if: JSDOM doesn't support getSelection */
7-
if (win && win.getSelection && win.getSelection().toString() !== '') {
8-
return true
12+
if (win && win.getSelection && win.getSelection().toString() !== '' && isElement(el)) {
13+
return sel.containsNode ? sel.containsNode(el, true) : false
914
} else {
1015
return false
1116
}

0 commit comments

Comments
 (0)