Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Cursor changes style while dragging

Open philipgiuliani opened this issue 10 years ago • 49 comments

When i hover the handle, i get the grabbing cursor style, but when I hold the item, it switches back to the default cursor.

Its also reproducible in the following example: http://jsbin.com/newize/1/edit?html,js,output

Tested in Chrome, Firefox

philipgiuliani avatar Jan 28 '15 08:01 philipgiuliani

You have the wrong CSS: http://jsbin.com/moqecozofo/1/edit

RubaXa avatar Jan 28 '15 08:01 RubaXa

I cant see any difference it the example, i still get the "default" cursor while i am dragging the item.

Seems that the browser handles this cursor. When i change dataTransfer.effectAllowed to "copy" for example, the cursor is an copying cursor, but "move" shows the default cursor. Im on OSX by the way. I think this cant be fixed.

philipgiuliani avatar Jan 28 '15 08:01 philipgiuliani

Were you able to find a workaround for this?

avoliva avatar Dec 10 '15 21:12 avoliva

No i haven't. I just left it how the browser means its "default". In OSX its the default cursor in all browsers :( :cry:

philipgiuliani avatar Dec 11 '15 08:12 philipgiuliani

+1. Is it impossible to apply a CSS cursor on drag? Maybe it's only OSX, but it defaults to "default" cursor on drag, regardless.

mjau-mjau avatar Mar 17 '16 06:03 mjau-mjau

+1. Setting the cursor style in CSS for the .sortable-ghost kept the cursor style when dragging in Firefox, but not in Safari or Chrome.

ashley71 avatar Mar 18 '16 23:03 ashley71

This is an issue for me too on chrome. During drag cursor is reset not default. Not the behavior I want and css isn't getting my anywhere.

taylorpoe avatar May 06 '16 23:05 taylorpoe

Here is a demo. https://codepen.io/adrianparr/pen/VaddEr

On Mac OSX it works in Firefox, but NOT in Chrome, Safari or Opera. I've not tested on Windows.

adrianparr avatar Jun 23 '16 10:06 adrianparr

+1 Same problem here for Chrome

lapinvert avatar Aug 08 '16 10:08 lapinvert

+1 same problem here too.

a5hik avatar Nov 15 '16 22:11 a5hik

+1 same problem here. OSX + Chrome

adrianenriquez avatar Dec 03 '16 11:12 adrianenriquez

+1 OSX / still works Firefox but not Chrome or Safari

kateray avatar Feb 13 '17 17:02 kateray

+1 Also wishing for this functionality!

cupofjoakim avatar Mar 20 '17 09:03 cupofjoakim

+1 OSX / still works Firefox but not Chrome or Safari

brianswisher avatar May 08 '17 19:05 brianswisher

+1 Please add this functionality!

cbwiedel avatar May 19 '17 21:05 cbwiedel

+1 For this functionality.

TaylorFoster90 avatar Aug 17 '17 15:08 TaylorFoster90

+1

vikyd avatar Sep 25 '17 06:09 vikyd

👍 please reopen this issue (even if it's impossible to fix for the owner... at least we know that there's a bug right now)

Oliboy50 avatar Oct 16 '17 15:10 Oliboy50

I'm having this issue as well.

Dragula's grab and grabbing cursors work fine in Chrome: https://bevacqua.github.io/dragula/.

Please reopen...

EthanDM avatar Dec 21 '17 20:12 EthanDM

+1, same issue here. Anyone else figure out a workaround for the grab cursor?

burlesona avatar May 08 '18 04:05 burlesona

+1, still facing the issue in chrome. Waiting for any workaround...

worldwideaman avatar May 14 '18 12:05 worldwideaman

I found a workaround. Add this css:

html.draggable-cursor {
	cursor: move; /* fallback: no `url()` support or images disabled */
	cursor: -webkit-grabbing; /* Chrome 1-21, Safari 4+ */
	cursor:    -moz-grabbing; /* Firefox 1.5-26 */
	cursor:         grabbing; /* W3C standards syntax, should come least */
}

Now add these two events:

// Sets default page cursor as grabbing
onStart: function (evt) {
	document.documentElement.classList.add("draggable-cursor");
}
...
// Restores default page cursor
onEnd: function (evt) {
	document.documentElement.classList.remove("draggable-cursor");
}

It is not perfect though, it works 60% ~ 80% of the time.

mauriciogior avatar May 14 '18 20:05 mauriciogior

SImilar to @mauriciogior 's workaround, I used "the !important" to the CSS property and that works fine for me 100% of the time.

maxr37 avatar Jul 20 '18 23:07 maxr37

Found a workaroun that works 100% of the time too. Used a mixed betwee, @maxr37 and @mauriciogior workarounds.

I used this css :

.draggable-cursor * {
	cursor: move !important; /* fallback: no `url()` support or images disabled */
	cursor: -webkit-grabbing !important; /* Chrome 1-21, Safari 4+ */
	cursor:    -moz-grabbing !important; /* Firefox 1.5-26 */
	cursor:         grabbing !important; /* W3C standards syntax, should come least */
}

And then in my .js file (Using jquery-ui draggable) :

$('.draggableElement').draggable({
	start: function (evt) {
		$('html').addClass("draggable-cursor");
	},
	stop: function (evt) {
		$('html').removeClass("draggable-cursor");
	}
});

Ritooon avatar Jul 25 '18 09:07 Ritooon

still not working for chrome

icenold avatar Sep 07 '18 23:09 icenold

I found out that cursor:grabbing doesn't work when the chrome devtools is open.

soopdop avatar Dec 05 '18 09:12 soopdop

@soopdop "fix" solved the mystery for me.

rixroll avatar Feb 15 '19 09:02 rixroll

This is not a sortableJS bug. We wrote our own drag-sort class which has the same issue.

Esger avatar May 09 '19 09:05 Esger

Dragula's grabbing cursors working with additional div element appended to body and listen mousemove - not html5 drag-n-drop

yulllll avatar May 28 '19 12:05 yulllll

html.draggable-cursor {
	cursor: move; /* fallback: no `url()` support or images disabled */
	cursor: -webkit-grabbing; /* Chrome 1-21, Safari 4+ */
	cursor:    -moz-grabbing; /* Firefox 1.5-26 */
	cursor:         grabbing; /* W3C standards syntax, should come least */
}

can you give a example , I have no idea where to put those codes

jjzjx118 avatar Aug 07 '19 08:08 jjzjx118