ui-sortable + ng-repeat selects text, requires extra click, with jQuery 2.0
pmanijak opened this issue · 4 comments
The code below is a ui-sortable list that uses ng-repeat, using jQuery 2.0.
The first attempt to drag and drop an item in the list will result in selecting text in the list, instead of moving the element. The second attempt works as expected, as do all attempts after that. When the page is refreshed, we're in a broken state again.
With jQuery 1.x, everything is fine.
If the ng-repeat is removed from the situation, and a static list is used instead, everything is fine.
Hard to say if this is an issue with jQuery, Angular, or Angular-ui, but the narrowed-down code below is a step toward answering that question.
<!doctype html>
<html lang="en" ng-app="myApp">
<body>
<div ng-controller="MyCtrl1">
<ul ui-sortable ng-model="test">
<li ng-repeat="t in test">
{{t.name}}
</li>
</ul>
</div>
<!-- jQueryUI is required by AngularUI -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script src="lib/angular/angular.js"></script>
<script src="lib/angular-ui/angular-ui.js"></script>
<script> 'use strict';
angular.module('myApp', ['ui']);
function MyCtrl1($scope) {
$scope.test = [
{ name: "one" },
{ name: "two" }
];
} </script>
</body>
</html>AngularUI is currently undergoing a restructure. This project will no longer hold the codebase, can you please relocate this to https://github.com/angular-ui/ui-sortable (after confirming it's still necessary with the latest code)?
Will do.
@exclsr did you manage to fix that issue. I have the same problem.
@demsey2 Nope. I've just been using jQuery 1.9 for the time being.
I moved this to the ui-sortable project: angular-ui/ui-sortable#2 as per @ProLoser's request.