Comments (11)
Like a boss. No more sticky div's :)
That's a new one for me too. I usually just return right away on right clicks in my app so I never ran into it!
from solid-dnd.
Hey. This sounds like a generally useful thing that we should add into the default sensor (ignore right clicks). Feel free to submit a PR. Alternatively I'll add this in future.
In the meantime, yes, you could create your own sensor implementation that ignores right clicks.
from solid-dnd.
In latest version I don't believe the behaviour happens anymore (due to improvements in the sensor logic), though there is no special handling for right clicks. Closing, but feel free to re-open if I am mistaken.
from solid-dnd.
Yep, still happens. Just revisited this great package to try and implement something that didn't work beforehand, now with .7+ it works... but the right click issue still persists.
To replicate, select "Basic drag & drop" from the main examples area on the website, right click on the "Draggable" object, dismiss the context menu, and you'll find the object is stuck to the cursor.
from solid-dnd.
@timothyallan I can't reproduce that π€ What OS and browser are you using? How are you dismissing the context menu?
from solid-dnd.
Wellllll, that is interesting. I'm on Mac, tried Chrome/FF/Safari and all in private browsing to make sure I wasn't getting cached data.
rightclick.mp4
from solid-dnd.
Hmm. I'm testing on Windows so that's a difference.
I'm happy to implement a check for right mouse button in the activation logic, but I'd like to understand what is happening here more first:
Has the click completed for you when the context menu shows? Or are you still pressing the mouse button down at that point?
from solid-dnd.
Itβs very odd that it happens with the OS being the difference! Iβm simply single right clicking and releasing, then left clicking somewhere other than the context menu. Nothing is being held down.
Does it in my solid app as well, which is what got me to try it on your site again just for kicks.
from solid-dnd.
That is odd indeed - logically the drag should not become stuck because on pointerup the listeners are removed and all drags stopped. The only way that could occur is if something else is intercepting and cancelling the pointerup event - I wonder if the contextmenu behaviour on mac is doing that π€
Perhaps on mac the contextmenu is activated on pointerdown and then intercepts the pointerup? Can you try and right press and hold to see if the contextmenu still appears?
Also, if you are able to build the solid-dnd library locally you could try adding some debugging to https://github.com/thisbeyond/solid-dnd/blob/main/src/create-pointer-sensor.ts to see what's going on.
from solid-dnd.
Console.log all the sensor functions :)
- Right click on a draggable object
- Browser context menu pops up
- DnD
attach
fires with apointerEvent button:2
onActivate
firesstate.active.sensor:null isActiveSensor():false
- moving mouse while context menu is up doesn't fire any events.
- Single left click anywhere in the browser to dismiss the context menu, object is now locked to cursor, and moving fires a bunch of
onPointerMoves
. - Single left click again fires
onPointerUp isActiveSensor():true
withbutton:0
detach
fires
from solid-dnd.
Thanks! That does look like the contextmenu is intercepting the onpointerup we rely on.
I've released 0.7.3 now that should fix it - please give it a go.
from solid-dnd.
Related Issues (20)
- Bento Draggable Layout HOT 2
- attach is used before it is defined HOT 1
- Non deterministic order of events onDragStart, onDragOver, onDragMove
- solid-dnd.com is down! HOT 2
- Get `useDragDropContext is not a function or its return value is not iterable` HOT 1
- TypeError: useDragDropContext is not a function or its return value is not iterable at createDroppable HOT 8
- Allowing access to mouse position on drag & drop context's events HOT 3
- Sortable with Draghandle HOT 4
- Placeholder at the beginning of a drag HOT 1
- createDraggable and createDroppable are not reactive HOT 2
- Conditionally Prevent Drag HOT 1
- Draggable SVG shape moves faster than pointer HOT 4
- Unable to load data dynamically. Please help HOT 2
- Recompute layouts on remove
- Access state and actions from callback handlers
- Get current droppable on onDragMove HOT 1
- Only the text is visible on the dragged element HOT 1
- Add support for sortables of irregular sizes. HOT 4
- Beginners Documentation HOT 10
- Trying to render a custom component as sortable HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid-dnd.