Skip to content

Conversation

@markvantilburg
Copy link
Contributor

A quick port of mouse.js to pointer events

A quick port of mouse.js to pointer events
missed a mouse
Copy link
Member

@mgol mgol left a 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?

@markvantilburg
Copy link
Contributor Author

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.

jquery-ui.min.1.14.1.js
sort.html

@mgol
Copy link
Member

mgol commented Sep 24, 2025

Cool, thanks! I'll try to test this some time in October, I won't have time before that.

@markvantilburg
Copy link
Contributor Author

I'm not sure if this safari specific code is still needed maybe that can be removed:

// Support: Safari <=8 - 9

image

@markvantilburg
Copy link
Contributor Author

@mgol is that safari code still needed?

@mgol
Copy link
Member

mgol commented Jan 26, 2026

@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 pointer.js.

Please drop the ignoreMissingButtons workaround.

Copy link
Member

@mgol mgol left a 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:

  1. Mouse & touch events have a different strategy for *up events - 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 for setPointerCapture & releasePointerCapture.
  2. 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.
  3. We need to handle the pointercancel event.

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
@markvantilburg
Copy link
Contributor Author

Removed the "ignoreMissingButtons" boolean and the safari workaround

@mgol
Copy link
Member

mgol commented Jan 27, 2026

I forgot to add that using setPointerCapture & releasePointerCapture should let you drop this listener on pointerup on document and just do it on the element. But do test this, at least on a computer with a mouse!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants