Skip to content

Commit 47dc490

Browse files
committed
Merge pull request johnny#54 from jogaco/master
Fixes johnny#53: input elements can still gain focus on click when inside sortable elements
2 parents b7996fa + 474b9a0 commit 47dc490

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

source/js/jquery-sortable.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@
9393
$("body").removeClass("dragging")
9494
},
9595
// Called on mousedown. If falsy value is returned, the dragging will not start.
96-
onMousedown: function($item, _super, event) {
97-
event.preventDefault()
98-
return true
96+
// If clicked on input element, ignore
97+
onMousedown: function ($item, _super, event) {
98+
if (event.target.nodeName != 'INPUT') {
99+
event.preventDefault()
100+
return true
101+
}
99102
},
100103
// Template for the placeholder. Can be any valid jQuery input
101104
// e.g. a string, a DOM element.

0 commit comments

Comments
 (0)