Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit de296f1

Browse files
committedApr 22, 2013
docs(compiler): don't drag selected content
In the example with draggable, the mouseDown handler needs to start with an event.preventDefault(). Otherwise the following bug occurs: 1) Select the text of the draggable span by clicking outside the span and dragging the mouse to the left or right through the span. Release the mouse button. 2) Now click on the span's inner text, and start to Drag it. The browser's default functionality that drags highlighted text so that it can be pasted into something else (say a document in a text editor) is invoked. 3) Release the mouse button. Now suddenly, you'll be dragging the span. But you won't be able to place it down on the page. It'll just follow the mouse around until the page is refreshed. Closes: #2465
1 parent 8c75b5f commit de296f1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎docs/content/guide/compiler.ngdoc

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Here is a directive which makes any element draggable. Notice the `draggable` at
7979
cursor: 'pointer'
8080
});
8181
element.bind('mousedown', function(event) {
82+
// Prevent default dragging of selected content
83+
event.preventDefault();
8284
startX = event.screenX - x;
8385
startY = event.screenY - y;
8486
$document.bind('mousemove', mousemove);

0 commit comments

Comments
 (0)
This repository has been archived.