File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/components/table/helpers Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
// Helper to determine if a there is an active text selection on the document page.
2
2
// 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'
3
8
4
9
export default function textSelectionActive ( ) {
5
10
const win = window
6
11
/* 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
9
14
} else {
10
15
return false
11
16
}
You can’t perform that action at this time.
0 commit comments