Fix issue with false selection detection
`selection.rangeCount` will return 1 when user is typing something in a form widget. This will consequently trigger unvoluntary scrolling when the mouse is moved outside of scrollable area. Checking the actual length of selected text doesn't trigger this behaviour.
This commit is contained in:
@@ -10,8 +10,8 @@ var h = require('../../lib/helper')
|
||||
function bindSelectionHandler(element, i) {
|
||||
function getRangeNode() {
|
||||
var selection = window.getSelection ? window.getSelection() :
|
||||
document.getSlection ? document.getSlection() : {rangeCount: 0};
|
||||
if (selection.rangeCount === 0) {
|
||||
document.getSelection ? document.getSelection() : {rangeCount: 0};
|
||||
if (selection.toString().length === 0) {
|
||||
return null;
|
||||
} else {
|
||||
return selection.getRangeAt(0).commonAncestorContainer;
|
||||
|
||||
Reference in New Issue
Block a user