Opened 14 years ago
Last modified 6 years ago
#4441 open bug
Selectable: Mousedown on scrollbar start selectable
Reported by: | Ludovic | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 2.0.0 |
Component: | ui.selectable | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Under Firefox, when you click on your scrollbar, it starts selection.
The selectable size is scrollWidth and not innerWidth.
It means that if e.layerX > scrollWidth, don't start.
Same for scrollHeight.
Attachments (1)
Change History (11)
comment:1 Changed 14 years ago by
Milestone: | TBD → 1.7.2 |
---|
comment:2 Changed 14 years ago by
Milestone: | 1.7.2 → 1.8 |
---|
comment:3 Changed 14 years ago by
Changed 14 years ago by
Attachment: | 4441_partial_patch.diff added |
---|
comment:4 Changed 13 years ago by
Doing it on the start event didn't work. This stackoverflow question has the following solution:
$(function() { $("#selectable").mousedown(function (evt) { evt.stopImmediatePropagation(); return false; }); $("#selectable").selectable(); });
comment:5 Changed 13 years ago by
I spoke too soon, that actually stops the selectables from being selectable.
comment:6 Changed 13 years ago by
My issue was with the scrollbar on a tbody and this worked for me at the beginning of ui.mouse _mouseDown:
if (event.pageX > this.element.width()) {
return true;
}
comment:7 Changed 13 years ago by
One workaround I found (and that could be used to fix this bug) is to wrap the sortable items with two divs. Then, Initialize selectable on the inner div, and set overflow to scroll on the outer div.
This way, your scrollbar lies on the outer div which is not a part of the selectable.
comment:8 Changed 11 years ago by
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:9 Changed 11 years ago by
Status: | new → open |
---|---|
Summary: | Mousedown on scrollbar start selectable → Selectable: Mousedown on scrollbar start selectable |
Verified this is still an issue as of 1.9.1 - http://jsfiddle.net/tj_vantoll/4fGTM/.
comment:10 Changed 6 years ago by
I know this issue hasn't been touched in 5 years, but I found a decent solution - This solution builds on Sam's original, but allows drag select to work in any blank canvas area that aren't scrollbars. It works by detecting if the point of the click that is beyond the view area.
$("#selectable").mousedown((event : JQueryEventObject) : void => { if (event.offsetX >= event.target.clientWidth | | event.offsetY >= event.target.clientHeight) { event.stopImmediatePropagation(); } });
I attached a "partial fix" for this ticket. One workaround is to allow the user to "cancel" the start operation by returning false from the triggered "start" method; the ui.selectable code would obviously then need to respect that and return before doing the select operation.
Also, to get around the issue of scrolling I added this check in my "start" method (which could probably be expanded on and added to the _mouseStart method directly).