Code Monkey home page Code Monkey logo

Comments (11)

timothyallan avatar timothyallan commented on June 2, 2024 1

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.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

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.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

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.

timothyallan avatar timothyallan commented on June 2, 2024

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.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

@timothyallan I can't reproduce that πŸ€” What OS and browser are you using? How are you dismissing the context menu?

solid-dnd-right-click

from solid-dnd.

timothyallan avatar timothyallan commented on June 2, 2024

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.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

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.

timothyallan avatar timothyallan commented on June 2, 2024

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.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

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.

timothyallan avatar timothyallan commented on June 2, 2024

Console.log all the sensor functions :)

  • Right click on a draggable object
  • Browser context menu pops up
  • DnD attach fires with a pointerEvent button:2
  • onActivate fires state.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 with button:0
  • detach fires

from solid-dnd.

martinpengellyphillips avatar martinpengellyphillips commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.