Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery draggable text selection bug

I am not sure if this is a bug - but in this example there is no way to select the text underneath the elements that can be dragged.

Same issue with form elements.

http://jqueryui.com/demos/draggable/handle.html

Any ideas?

like image 713
Eeyore Avatar asked Dec 22 '22 08:12

Eeyore


2 Answers

If you look at the source code for that page, you'll see that it calls

$("div, p").disableSelection();

... which explicitly disables selection on all divs and ps on the page, including those beneath the draggable elements.

like image 75
Daniel LeCheminant Avatar answered Dec 26 '22 20:12

Daniel LeCheminant


The "official" jQuery way of doing things is to use .disableSelection(). However, often times in practice, that does absolutely nothing. In this case you can bolt down all text on the page with

document.onselectstart = function () { return false; }
like image 41
Udo Avatar answered Dec 26 '22 20:12

Udo