#4293 closed bug (fixed)
Ctrl + Click on selected list item does not deselect
Reported by: | managingmeals | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8.2 |
Component: | ui.selectable | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
You can use ctrl and a mouse click to select items that are non- adjacent. However if you try to click a selected item while holding control it does not deselect it. This is how one would expect it to function as this is how windows explorer (and i think its the same on mac).
A sample is windows explorer. Make your selection either with ctrl to select individual items or a lasso for multiple items, or a combination of both. After you do that you can deselect whatever you want and keep the rest selected by holding ctrl and and click a selected item.
Maybe this is already possible and im not seeing it or its a bug? I don't see any documentation of it, or a sample of it.
Please add this feature, if its not already added.
Thanks
Change History (9)
comment:1 Changed 14 years ago by
Milestone: | TBD → 1.8 |
---|
comment:2 Changed 14 years ago by
Milestone: | 1.8 → TBD |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:3 Changed 13 years ago by
I'm using the latest version of jQuery along with the most recent version of the UI, and I'm not seeing an resolution to this issue.
I've tried it myself to no avail, and it also doesn't even work on your own demo page found here: http://jqueryui.com/demos/selectable/
This is a frustrating issue when you have a large list of items that users are selecting from, as if they happen to select one they didn't mean to, they'll have to start all over from the beginning to deselect the undesired item.
comment:4 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I don't know why this issue was closed as the new selectable refactor is still in development. See http://wiki.jqueryui.com/Selectable
comment:5 follow-up: 6 Changed 13 years ago by
I made a small change to _mouseStart function to get this to work as described using the metaKey (Ctrl/Cmd).
this.selectees.filter('.ui-selected').each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; if (!event.metaKey) { selectee.$element.removeClass('ui-selected'); selectee.selected = false; selectee.$element.addClass('ui-unselecting'); selectee.unselecting = true; // selectable UNSELECTING callback self._trigger("unselecting", event, { unselecting: selectee.element }); } });
comment:6 follow-up: 7 Changed 13 years ago by
Replying to jaysoo:
I made a small change to _mouseStart function to get this to work as described using the metaKey (Ctrl/Cmd).
this.selectees.filter('.ui-selected').each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; if (!event.metaKey) { selectee.$element.removeClass('ui-selected'); selectee.selected = false; selectee.$element.addClass('ui-unselecting'); selectee.unselecting = true; // selectable UNSELECTING callback self._trigger("unselecting", event, { unselecting: selectee.element }); } });
Commented on GitHub "When unselecting is triggered, the property key needs to be 'unselecting' not 'selecting'. Compare lines 116, 202, 215."
comment:7 Changed 13 years ago by
Replying to rdworth:
Commented on GitHub "When unselecting is triggered, the property key needs to be 'unselecting' not 'selecting'. Compare lines 116, 202, 215."
My bad, here's the new commit: http://github.com/jaysoo/jquery-ui/blob/13238fa835084e88aa10a7442db9f9214a67c86b/ui/jquery.ui.selectable.js
$(event.target).parents().andSelf().each(function() { var selectee = $.data(this, "selectable-item"); if (selectee) { var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected'); selectee.$element .removeClass(doSelect ? "ui-unselecting" : "ui-selected") .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); selectee.unselecting = !doSelect; selectee.selecting = doSelect; selectee.selected = doSelect; // selectable (UN)SELECTING callback if (doSelect) { self._trigger("selecting", event, { selecting: selectee.element }); } else { self._trigger("unselecting", event, { unselecting: selectee.element }); } return false; } });
comment:8 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:9 Changed 13 years ago by
Milestone: | TBD → 1.8.2 |
---|
fixed in new selectable