Skip to content
Browse files

Selectable: Explicitly check event.ctrlKey now that jQuery differenti…

…ates between meta and ctrl. Fixes #7858 - ctrl-click to select multiple elements not working.

(cherry picked from commit 35dd041)
  • Loading branch information...
1 parent 63bd71f commit ffd3f510f1c0fbfe99ce2f1aab81d56d9b03f88e @scottgonzalez scottgonzalez committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 ui/jquery.ui.selectable.js
View
8 ui/jquery.ui.selectable.js
@@ -103,7 +103,7 @@ $.widget("ui.selectable", $.ui.mouse, {
this.selectees.filter('.ui-selected').each(function() {
var selectee = $.data(this, "selectable-item");
selectee.startselected = true;
- if (!event.metaKey) {
+ if (!event.metaKey && !event.ctrlKey) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
selectee.$element.addClass('ui-unselecting');
@@ -118,7 +118,7 @@ $.widget("ui.selectable", $.ui.mouse, {
$(event.target).parents().andSelf().each(function() {
var selectee = $.data(this, "selectable-item");
if (selectee) {
- var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
@@ -188,7 +188,7 @@ $.widget("ui.selectable", $.ui.mouse, {
} else {
// UNSELECT
if (selectee.selecting) {
- if (event.metaKey && selectee.startselected) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
selectee.$element.removeClass('ui-selecting');
selectee.selecting = false;
selectee.$element.addClass('ui-selected');
@@ -207,7 +207,7 @@ $.widget("ui.selectable", $.ui.mouse, {
}
}
if (selectee.selected) {
- if (!event.metaKey && !selectee.startselected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;

0 comments on commit ffd3f51

Please sign in to comment.
Something went wrong with that request. Please try again.