Git Product home page Git Product logo

Comments (6)

xDUDSSx avatar xDUDSSx commented on September 26, 2024 1

I was indeed testing with the troublesome Firefox on Windows.
After your fix it works as expected for me.

I applaud you for such a quick and in-depth response for what is a somewhat minor issue :D.
If you're happy with the fix you can close this.

from svelte-tweakpane-ui.

kitschpatrol avatar kitschpatrol commented on September 26, 2024

Hi, thanks for using the library and for bringing this to my attention!

I'll look into it. Pointer events can be tricky since the browser doesn't always send them when it should...

from svelte-tweakpane-ui.

xDUDSSx avatar xDUDSSx commented on September 26, 2024

I noticed the same issue being discussed here at the interact.js repo which is also dealing with making elements draggable.
taye/interact.js#962
Seemingly they haven't found a solution yet so maybe it's a bit more problematic like you said.

from svelte-tweakpane-ui.

kitschpatrol avatar kitschpatrol commented on September 26, 2024

Thanks for the link, I will take a look. There might be another event I can listen for, perhaps when the window loses focus.

Will play around with it in the next few days.

from svelte-tweakpane-ui.

kitschpatrol avatar kitschpatrol commented on September 26, 2024

So far I'm only able to reproduce this in Firefox. Safari and Chrome seem fine.

Do you mind sharing which browser you're testing with?

from svelte-tweakpane-ui.

kitschpatrol avatar kitschpatrol commented on September 26, 2024

Ok, I've just published a likely fix in v1.2.5. Panes now listen for the window's blur event while dragging, and treat it as a pointercancel event.

Just to make sure we're on the same page about the issue, my test cycle is:

  1. Start dragging the Pane toolbar or width-adjustment handle.
  2. Command-tab to blur the browser window.
  3. Release the mouse outside the browser window.
  4. Reposition the mouse over the unfocused browser window, expecting that Pane dragging has ended, and that the cursor shows its default style.
  5. Click to re-focus the browser window, expecting that subsequent Pane drag gestures will work correctly.

In my admittedly informal testing, WebKit and derivatives on the Mac seem to handle this edge case correctly in the previous release of Svelte Tweakpane UI, at least on the desktop, but Firefox does not and Windows is a universal mess:

Browser pointerup while blurred :active update while blurred
Safari Mac ✅ Yes ✅ Yes
Chrome Mac ✅ Yes ✅ Yes
Chrome Windows ❌ No ✅ Yes
Firefox Mac ❌ No ❌ No
Firefox Windows ❌ No ❌ No
Edge Windows ❌ No ❌ No

The sticky :active pseudo-class is particularly frustrating, because even if you successfully stop the dragging while unfocused, CSS selectors using :active (e.g. the cursor style) will remain stuck in their pre-blur state until you re-focus the browser.

I did find a work-around for the cursor: Dispatching a synthetic pointercancel event, then changing the cursor style directly via JS seems to trigger a cursor redraw, but :active still lingers in some Windows browsers.

I also added support for pointercancel events as you suggested, just for good measure.

I agree that the Firefox / Windows behavior was definitely broken, and is improved by this fix... but I think it actually makes the UX in Safari and Chrome on the Mac worse, since recovery of drag state is both occasionally useful and consistent with the behavior of native apps.

As loathe as I am to degrade the WebKit Mac experience, I'm more loathe to do platform detection, so I'll keep this fix in for now. Such is life in the web UX crab bucket. 🫠

Let me know if it's a fix on your end.

from svelte-tweakpane-ui.

Related Issues (7)

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.