Skip to content
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

Update jQuery related libraries in core to their latest version, where possible #6185

Closed
indigoxela opened this issue Jul 29, 2023 · 8 comments · Fixed by backdrop/backdrop#4485

Comments

@indigoxela
Copy link
Member

indigoxela commented Jul 29, 2023

Description of the bug

Some JavaScript libraries used in core could get updated. Sort of a follow-up to #3106 and #6149.

Note that jQuery core is up-to-date, and jQuery UI has its own (stalled) issue on #5705.

But there's more. Core also ships with...

  • jquery.cookie.js (hopelessly outdated, not in use in core, maybe deprecate)
  • jquery.ui.touch-punch.js (very old, possibly broken for a while)
  • jquery.timeentry.js (used with the date popup widget for time input, incredibly old but functional)
  • jquery.once.js (2.2.3 is available but 2.x breaks existing use)
  • jquery.form.js (update to 4.3.0 - no substantial changes)

Why bothering?

Especially jquery.form.js and jquery.once.js are used all over the place in core. And both libraries still use functions that are deprecated in jQuery 3.x.

Other libs seem abandoned, they didn't get updated for more than a decade and it's time to possibly consider alternatives. Goal here is to update what we can update.

Conclusion: what we can update

  • jquery.form.js (update to its latest version, no significant change)
  • jquery.ui.touch-punch.js (switch vendor, update to a functional fork - our current version is abandoned and broken)
@indigoxela
Copy link
Member Author

Some findings so far: the latest jquery.form.js still isn't fully fixed, see their issue for that. A PR exists for a while, but the issue seems to have stalled a bit.

It's tricky re jquery.once.js. The new version 2.2.3 breaks all sorts of stuff in core. The change we'd need in 1.2.6 to get rid of deprecated functions is minimal, but that means, we'd fork it (the 1.x version isn't big).
Drupal deprecated jquery.once and replaced it with a more complex custom (vanilla js) lib. I doubt, that we could do something like that before 2.x.

@indigoxela
Copy link
Member Author

indigoxela commented Jul 29, 2023

Re jquery.ui.touch-punch.js the original repo seems more or less abandoned, but there seems to be a maintained fork. Didn't dig into details.

It's a dependency of backdrop.ckeditor.admin via ui.draggable. We might eventually be able to get rid of it in core, but might be forced to keep it for contribs. Not sure, where it's in use outside backdrop.ckeditor.admin. I'm also not sure, how functional it is, as touch events in browsers might be a moving target.

@indigoxela
Copy link
Member Author

A PR to start with, which updates jquery.form.js to 4.3.0.

In jquery.once.js we'd only need to switch from $.isFunction(fn) to typeof fn == 'function' in two places, but as it's not our code, I didn't touch it.

@indigoxela
Copy link
Member Author

indigoxela commented Jul 30, 2023

After testing the ancient version of jquery.ui.touch-punch.js we currently have, my conclusion is that it's not working anymore, neither with jQuery 1.12 (legacy), nor with 3.7 (latest).

I verified with Layout admin UI (drag-and-drop sorting) and with CKEditor admin UI (buttons configuration).

However, the forked version (https://github.com/RWAP/jquery-ui-touch-punch/) seems to work. This needs more testing with actual touch devices, though.

@yorkshire-pudding
Copy link
Member

@indigoxela - based on the comments above, I tested the touch punch by editing the text format to drag another button to the task bar on my mobile:

Android 13 | Chrome 115.0.5790.166

It worked well.

@tkcent
Copy link

tkcent commented Aug 8, 2023

Tested same as @yorkshire-pudding above and it was successful.

Safari on iOS 16.5.1(c)

@herbdool
Copy link

herbdool commented Aug 9, 2023

Code looks good.

@quicksketch
Copy link
Member

Thanks folks! I merged backdrop/backdrop#4485 into 1.x only. With all the other jQuery updates going into 1.26.0 I figured we can keep them all in one release. 1.26.0 is just around the corner anyway.

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

Successfully merging a pull request may close this issue.

5 participants