-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Create pointer.js #2371
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
base: main
Are you sure you want to change the base?
Create pointer.js #2371
Conversation
A quick port of mouse.js to pointer events
missed a mouse
mgol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Did you test the module with mouse & touch?
|
I tested it with a mouse (on desktop) and in chrome on my android, by replacing 'mouse' with 'pointer' with Slider and Sortable. I tested with this file/js combination. More testing is needed for this feature. |
|
Cool, thanks! I'll try to test this some time in October, I won't have time before that. |
|
I'm not sure if this safari specific code is still needed maybe that can be removed: Line 144 in 13bbc77
|
|
@mgol is that safari code still needed? |
|
@markvantilburg The Safari issue was reported at https://bugs.jqueryui.com/ticket/14461/. The bug caused dragging the box in Safari to be stopped as soon as a modifier key like Shift or Command was pressed during the drag. The issue was fixed in jQuery UI 1.12, which is convenient as it can be reproduced on https://api.jqueryui.com/1.11/draggable/#entry-examples. I tested that URL on BrowserStack in various Safari versions and I could reproduce it in versions 16.5 or older but not in versions 17.3 or newer. Which is a good news. jQuery UI only supports the latest version of each browser, so we're fine to drop this workaround and definitely to not backport it to Please drop the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this thoroughly, but the basic functionality works for the slider on both desktop & mobile with this PR + gh-2373; thanks for preparing these PRs!
That said, I think there are more changes to be made here:
- Mouse & touch events have a different strategy for
*upevents - for mouse, they fire at the element above which the cursor was placed when it was relieved; for touch events, it fired at the element where the touch started. Pointer Events have a mechanism to opt into this touch behavior which is more convenient for drag operations; see MDN docs forsetPointerCapture&releasePointerCapture. - Pointer Events support multi-touch. Ideally, we'd allow to drag both slider handles for the range slider, but perhaps that'd be too big of a change. In that case, we should at least ensure the second & subsequent pointers are ignored.
- We need to handle the
pointercancelevent.
That's it for now. Would you like to continue the work on this PR?
Remove "ignoreMissingButtons" boolean and change the if to remove the custom safari code
|
Removed the "ignoreMissingButtons" boolean and the safari workaround |
|
I forgot to add that using |

A quick port of mouse.js to pointer events