mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Selectable: modified _mouseStart function to unselect event.target if the Ctrl/Cmd key is pressed, and target is selected. Fixed #4293 - Ctrl + Click on selected list item does not deselect
This commit is contained in:
parent
114c001aba
commit
5b4c04acb5
15
ui/jquery.ui.selectable.js
vendored
15
ui/jquery.ui.selectable.js
vendored
@ -121,12 +121,15 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
$(event.target).parents().andSelf().each(function() {
|
$(event.target).parents().andSelf().each(function() {
|
||||||
var selectee = $.data(this, "selectable-item");
|
var selectee = $.data(this, "selectable-item");
|
||||||
if (selectee) {
|
if (selectee) {
|
||||||
selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');
|
var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
|
||||||
selectee.unselecting = false;
|
selectee.$element
|
||||||
selectee.selecting = true;
|
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
|
||||||
selectee.selected = true;
|
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
|
||||||
// selectable SELECTING callback
|
selectee.unselecting = !doSelect;
|
||||||
self._trigger("selecting", event, {
|
selectee.selecting = doSelect;
|
||||||
|
selectee.selected = doSelect;
|
||||||
|
// selectable UNSELECTING callback
|
||||||
|
self._trigger(doSelect ? "selecting" : "unselecting", event, {
|
||||||
selecting: selectee.element
|
selecting: selectee.element
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user