jQuery UI is currently not touch-compatible. Using the jQuery methods for draggable(), sortable(), droppable(), etc all do not currently have any support on touch devices. Currently we only have a few places in core that actually utilize jQuery UI: Dialogs in views and the CMI diff interface, and the drag and drop toolbar configuration for CKEditor.

jQuery UI *will* eventually support touch events natively. It's planned for jQuery UI 1.13 (that's 3 releases away from the current version)in the jQuery UI Roadmap. When that happens, places that use jQuery UI will immediately become touch-compatible.

Until then, if we want to make jQuery UI touch compatible the easiest approach is installing Touch Punch, a miniscule library that essentially tricks jQuery UI into supporting touch events.

I'm not sure if we should go forward with this immediately or just wait it out for jQuery UI 1.13. In any case, this patch adds Touch Punch and uses it on CKEditor admin interface to demonstrate its functionality. The nice thing is if we decided to get rid of it later, removal is should be just as simple as deleting it.

CommentFileSizeAuthor
touch_punch.patch2.78 KBquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

We might also consider if we just want to make jQuery UI (or some parts of it) depend on Touch Punch directly instead of adding it on an a-la-carte basis. Right now I've added it as a dependency for ckeditor.admin, but it could just be added everywhere instead.

Wim Leers’s picture

#1 sounds sensible to me.

Wim Leers’s picture

Issue tags: +CKEditor in core
jessebeach’s picture

We should coordinate solutions between this issue and #1261002: Draggable tables do not work on touch screen devices.

Bojhan’s picture

Wait, what? I agree with jesse that this needs some coordination, we don't want one-off libraries, only for CKEditor.

quicksketch’s picture

I agree with jesse that this needs some coordination, we don't want one-off libraries, only for CKEditor.

Please actually read the issue summary. This would affect all places where we use jQuery UI for draggables, not just CKEditor.

As noted in #1261002: Draggable tables do not work on touch screen devices a couple of times now, tabledrag.js is not and cannot be based on jQuery UI, because jQuery UI does does not support table rows (and it can't) because of requirements of how the DOM works (you can't take a table row out of its parent table in any sane way). The only options for tabledrag are either to A) specifically write touch support for tabledrag.js or B) find a different UI solution instead of using tables at all that could leverage jQuery UI. So basically I think this issue is entirely separate from #1261002: Draggable tables do not work on touch screen devices. We need a generic solution for jQuery UI (that's what this issue is) and we need a specific solution for tabledrag.js (that's what the other issue is).

jessebeach’s picture

because jQuery UI does does not support table rows (and it can't) because of requirements of how the DOM works (you can't take a table row out of its parent table in any sane way)

This is definitely a problem of the blocks UI, but we might get around this by rendering the HTML as a something other than a table and just styling to be table-like in presentation.

In any case, I just wanted to make sure we're cross-linking issues that may be related.

sun’s picture

Given the recent direction of #1261002: Draggable tables do not work on touch screen devices, is this issue still relevant?

In case it is, adding a default library for this seems sensible.

I don't know whether Touch Punch is the best library though, as I'm not familiar with available libraries in that space. The issue summary does not clarify which other libraries were evaluated.

quicksketch’s picture

Yes, this issue is still relevant. Touch Punch essentially is the same basic idea as #1261002: Draggable tables do not work on touch screen devices: it makes touch events emulate mouse events. As far as I know, Touch Punch is the best solution for jQuery UI. Unlike tabledrag.js, we can't modify jQuery UI directly, so it has to be amended by an add-on JS file.

sun’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Assigned: Unassigned » Dries

Dries normally likes to sign off on these.

webchick’s picture

Assigned: Dries » Unassigned

Ok, demoed this to Dries and he's a fan. :)

Committed and pushed to 8.x. Thanks!

quicksketch’s picture

Wow, it's not often you get a 1-patch directly into core!

I wanted to bring back up my first comment for future integrations:

We might also consider if we just want to make jQuery UI (or some parts of it) depend on Touch Punch directly instead of adding it on an a-la-carte basis. Right now I've added it as a dependency for ckeditor.admin, but it could just be added everywhere instead.

So basically what this patch has done is make the CKEditor admin interface touch-compatible, but not anything else that uses jQuery UI (e.g. our modals in the diff interface). It might be better to just add touch punch everywhere we add the jQuery UI draggable.js library, so each library doesn't need to specify the dependency manually.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Needs followup

Uh, not sure how I missed marking this fixed earlier.

Might be a good idea to file a follow-up for #13.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Clarifying removal