-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set CSS cursor on sortable helper #212
Comments
Your helper doesn't even get className - SortableHelperWithOverride. You have set helper className - (overridePointerEvents) ? 'SortableHelperWithOverride' : 'SortableHelper'. Seems like overridePointerEvents is false. If You set className to helper just - 'SortableHelperWithOverride', it works. |
@konutis There are two sortable lists. The top one does not have the override; the bottom one does (line 47 in the JS). The sortable helper in the bottom one is in fact getting the The point of this issue is to ask: should |
Plus one on this. Can't get |
@MtDalPizzol Just in case you didn't see it, take a look at my example code (https://jsfiddle.net/pufcv77k/3/) for a workaround. Set a |
Hey, @rosston ! Thanks! It worked... I haven't opened the fiddle because when I read your post I had the impression you were only reproducing the problem, not presenting a possible solution... Anyway.... thanks again! This solution is pretty enough for me... nothing to crazy... |
@rosston A note and a question: first, it appears your trick does not work in Safari, FWIW. Maybe Safari doesn't support pointer events yet? Also, more importantly, I don't understand how to set
...and I get very spotty behavior in Chrome. Sometimes, I'll see the grabbing cursor for a split second, and then it'll revert back to the cursor I get when hovering over the draggable item. Other times (though less often), I'll see the grabbing cursor for the duration of the drag and drop operation. |
@bmueller-sykes You're right that it (mostly) doesn't work in Safari (at least 11). I can't remember if it worked fully in Safari 10.1, but I don't have it handy now. What it does do in Safari is prevent a text selection from happening on the background elements. And FWIW, Safari does support pointer-events, just apparently not in the same way as other browsers. 🙂 As for Chrome, is it possible you just need to use |
Thanks for the reply! This does appear to make things more reliable:
...but it's not perfect. It looks like that css command is competing with some other css cursor commands I've got within the dragging item. I don't know if that's a fundamental problem, or just something unique to my code. |
Actually I have found a way to make it work with Chrome and Firefox without changing the pointer-events but by setting the cursor on the container and the (sortable) items when dragging. I'm adding a className on the container in you can see it in my fiddle. It still doesn't work in Safari unfortunately I hope it can help |
so does anyone know of a way to make this work with safari? All of the solutions here fail in Safari. I don't even know why :( |
also how does the react-beautiful-dnd from atlassian manage to make this work on safari I wonder. |
this helps on this issue as well (but Safari still doesn't work properly) |
I will describe how I solved this problem.
and for inner tag set pointer-events to none, to prevent that element become target of pointer events:
|
Any CSS
cursor
property is ignored on the sortable helper, and the cursor on the screen is determined by the background content that the helper is currently being dragged over (this part of the bug is actually the weirdest to me). Example here: https://jsfiddle.net/pufcv77k/3/The problem appears to have been introduced here: #160. It looks like that change fixes scrolling-while-dragging only when the sortable items are in a container with
overflow: auto;
, but perhaps I'm missing another scenario?Not sure what the fix is here, if anything. I'd prefer not to have to set
pointer-events: auto !important;
to allow a custom cursor (and quash the weird background cursor behavior), but I'm not sure which behavior is preferred as default.The text was updated successfully, but these errors were encountered: