Problem/Motivation
JQuery UI was added as a dependency for core 10 years ago to improve our UX. Since then majority of the frontend community has moved on to using other libraries. For that reason, JQuery UI has been having trouble attracting new maintainers, and has been unmaintained since 2017 as announced by one of the maintainers of the project in this blog post. The most recent release was published in 2016 and there's no one responding to PRs in their Github repository.
In the meantime the former jQuery foundation became the JS foundation which merged with Node's foundation and formed OpenJS Foundation. That lists jQuery UI as an Emeritus project in https://openjsf.org/projects/ which is described as:
Emeritus projects are those which the maintainers feel have reached or are nearing end-of-life
#3051352: [Plan] Remove unused jQuery UI components and replace with a suite of contrib packages for the continuous upgrade path provides a plan for libraries that are unused.
Proposed resolution
List of jQuery UI components in the scope of this issue:
- #3113400: Deprecate more jQuery UI library definitions
- jquery.ui.dialog: #2158943: Add a native dialog element to deprecate the jQuery UI dialog
- jquery.ui.autocomplete: #3076171: Provide a new library to replace jQuery UI autocomplete (see also #1899236: Add new Splitbutton render element to eventually replace Dropbutton)
- jquery.ui.datepicker: #3072906: Deprecate and remove jQuery UI datepicker
- jquery.ui.sortable: #3064049: Replace jQuery UI sortable with Sortable js
- jquery.ui.tabs: #3070369: Remove Drupal\views_ui\ViewEditForm::form dependency to jQuery UI tabs ⇢ this means that this has zero uses in core, so it can now be deprecated as part of #3067251: Deprecate unused jQuery UI components in favour of a suite of contrib modules
- jquery.ui.draggable #3079748: Deprecate jquery.ui.draggable
- jquery.ui.position: #3074267: Replace jQuery UI position() with PopperJS
- #3113649: Remove drupal.tabbingmanager's jQueryUI dependency and #3179734: Refactor uses of the :tabbable selector and deprecate it
With these components, we have a few different directions we could choose to go to:
- Replace jQuery UI components with a set of individual libraries.
- Rebuild jQuery UI functionality ourselves. This could be done either by using vanilla JavaScript or by using a framework such as React.
- Fork the parts of jQuery UI that are used by Drupal core, and provide support to the forked project ourself.
Various proposed replacements
(Libraries specific to only one component can be documented in the appropriate issue.)
- https://allyjs.io/api/index.html#finding-elements
- http://youmightnotneedjqueryplugins.com/
- https://plainjs.com/javascript/plugins/ui/
- https://van11y.net/ (repos at e.g. https://github.com/nico3333fr/jquery-accessible-tabs-aria)
Remaining tasks
In order of most work needed to least
| #2158943: Add a native dialog element to deprecate the jQuery UI dialog |
|
| #3076171: Provide a new library to replace jQuery UI autocomplete | There is already a working solution with test coverage, but it’s a significant addition that needs further review. |
| #3179734: Refactor uses of the :tabbable selector and deprecate it | Though technically postponed, this can be worked on if the almost-completed #3113649: Remove drupal.tabbingmanager's jQueryUI dependency is part of the patch (it can just get rerolled once that lands) |
| #3113649: Remove drupal.tabbingmanager's jQueryUI dependency | Near complete and may be RTBC-able once there's agreement regarding how to handle the jQuery UI tabbale file that isn't in use by core. |
Comments
Comment #2
catchSuggested places to look from the previous issues:
https://allyjs.io/api/index.html#finding-elements
http://youmightnotneedjqueryplugins.com/
https://plainjs.com/javascript/plugins/ui/
Also adding some related issues/prior work.
And marked #3067255: Find replacements for jQuery UI components as duplicate - crossposted with lauriii but this has the better issue summary.
Comment #3
mikelutzJust my thoughts, copied from slack:
I feel like, since there hasn’t been a commit in 3 years to jquery_ui, that we should just do option 3 right now for the remaining components and decouple. Clearly we don’t have to worry about managing backports, so there’s no added maintenance in the short term. Then we should decide on long term option 1 or 2 component by component, and as we get closer to jQuery 4 and Drupal 9, we have the ability to prioritize the remaining components however makes the most sense.
The big problem with that, of course, is adding all that new (I assume) non ES6 code into core
I’m not a JS guy, but I know we don’t have a ton of JS devs working on core, and I know there was a lot of work going into converting to ES6, so I can’t imagine forking non-es6 code and just adding it with follow-ups will be super popular.
I don’t like adding technical debt to core, but realistically, it wouldn’t add more debt than we already have using the unsupported library, it just opens up options on how to fix it in a more controlled manner.
Comment #4
xjmFor me, forking or maintaining jQuery UI code should be our last resort. We can barely maintain our own existing legacy JavaScript, much less massive additional libraries. It's a lot of technical debt.
I also don't want us to take on the technical debt of porting these jQuery UI components to jQuery 4, or to support them in Drupal 10. So I recommend the following process:
Comment #5
xjmAlso would like to hear the JS initiative's thoughts on all that legacy ES5 code becoming our problem. I don't think we should expend energy converting it to ES6 since it's EOL. We could just skip the files, or package them as a separate project somehow.
Comment #6
xjmComment #14
xjmAdding contribution credit for people who helped discuss this problem space in the previous issue.
Comment #15
GrandmaGlassesRopeManFrom my perspective, this seems like our only real option. Given the relatively delayed start on this work, I don't think it's reasonable to expect a drop-in replacement for the needed jQuery UI components to be available within the required timeframe.
I think Sally suggested (slack/another issue/etc.) that we fork the existing jQuery UI package and only include the components we are currently using. I 100% agree with this.
This gives us a bundle of code that everyone is familiar with, meeting our current standards for inclusion with core, accessibility, etc. We won't be dependent on numerous other release cycles for smaller independent packages. Additionally this gives us some time to develop an alternative solution that could be implemented sometime in the 9.x release cycle.
Comment #16
droplet commentedAll new libs should be able to resolve all current issues. Refined requirements of each component for the CORE & potential usage of every site provides a clean view to cross out the requests out of the scopes.
For the instances, with "Lean Core", 3rd parties should be highly extendable. It has to take into account in the selection reviews.
- the new Dialog should resolve the nested modal problem at the same time
- jquery.ui.datepicker is useless in Drupal Core. Simplify it with inputs provides a better UX for both mobile & desktop.
- sortable & draggable should be the same lib
- tabs should share the lib with collapse (It has the same functionality with different visual styling actually)
(Drupal has independent tab lib in CORE: vertical-tabs.es6.js & collapse.es6.js)
Comment #17
nod_Quick question, do we want to have non-drupal related packages on drupal.org? I mean if we fork jquery ui, or we create a new js-only library that we want people to be able to use outside php/drupal. Shouldn't we keep that on drupal.org instead of putting it outside on github?
Comment #18
andypost@nod_ drupal.org now running gitlab aside, which now perfectly supports releases additionally to existing "git archive" of current system
Comment #19
lauriiiComment #20
lauriiiComment #21
wim leersHaving worked a lot with jQuery UI components while working on Quick Edit, I am terrified by the idea of maintaining it ourselves. Despite good intentions by its maintainers, it was not very reliable, nor clearly documented. Understanding its code is very difficult. So option 3 terrifies me for that reason alone. What makes it eve more scary is that like @xjm indicates in #4, we barely manage to maintain our own JS.
That being said, given the very tight timeframe, I'm not sure we have any other option. I think we should try to convert Drupal core to use other JS libs for the use cases mentioned in the issue summary, but whether we'll succeed is uncertain. However, this too comes with consequences: Drupal core itself is styling jQuery UI dialogs differently and Drupal's CSS and JS use jQuery UI-coupled selectors. This means contrib modules and themes do the same. Changing to a different JS library would be disruptive, which is exactly what we want to avoid. So I agree with @drpal's reasoning in #15, but have additional concerns that make me agree with his recommendation.
If we agree with @droplet's statement in #16, then I think even trying may be a waste of time and energy. Doing this for one or maybe two jQuery UI components may work out, but doing it for all of the ones listed in the issue summary is certainly not going to be possible before 8.8.0-alpha1. If the time pressure wasn't present, I'd agree with @droplet: we of course don't want to switch from one suboptimal solution to another suboptimal solution. But given time pressure, we may have no choice. This seems to just confirm @alwaysworking's comment in #15.
Comment #22
lauriiiComment #23
wim leersThanks for linking to #2158943: Add a native dialog element to deprecate the jQuery UI dialog for
jquery.ui.dialog, @lauriii. I attempted to try to find another contributor to help with that since it's pretty isolated: https://twitter.com/wimleers/status/1157261418913308672 🤞EDIT: woah, I just noticed he actually linked to #3071552: Replace jQuery UI dialog with a supported dialog library. I wonder how I then ended up in #2158943: Add a native dialog element to deprecate the jQuery UI dialog by following links 🤔In any case, I think it'd be good to continue in that pre-existing issue with some prior art and discussion (but not overwhelmingly much) rather than starting a new one.
Comment #24
bnjmnmComment #25
bnjmnmComment #26
bnjmnmComment #27
wim leersFor
core/jquery.ui.tabs, #3070369: Remove Drupal\views_ui\ViewEditForm::form dependency to jQuery UI tabs removed the only use. 🥳 But we still have to deprecate it. 😊Comment #28
wim leers#27 is wrong —
core/jquery.ui.tabswill be deprecated in #3067251: Deprecate unused jQuery UI components in favour of a suite of contrib modules.Comment #29
droplet commentedJust want to point out one thing about reusable.
#3051766: Deprecate and replace jQuery Joyride (for tours)
shepherdJS powered by -> tippyjs -> Popper.js
#2207383: Create a tooltip component
It can be tippyjs now
#3074267: Replace jQuery UI position() with PopperJS
It must be Popper.js
If it happened, I suggested making a custom build of shepherdJS to exclude "tippyjs" from it.
Comment #30
bnjmnmComment #31
finnsky commentedRe #29
@droplet please have a look i added this build for tests.
https://github.com/iberdinsky-skilld/shepherd/commit/f4a8ee3cd02142ced93...
generates shepherd with tippy.js as global variable using external globals feature of rollup https://rollupjs.org/guide/en/#core-functionality
Comment #32
lauriiiIt would be great to do a bit of planning what happens if we fail to convert all jQuery UI components to an alternative component before Drupal 8.8.0-alpha1. We've made good progress on the child issue but it seems likely that not all of them are done on time. Do we want to start planning how are we going to maintain jQuery UI components or could we make an exception and allow the jQuery UI work to continue in Drupal 8.9.x branch?
Comment #33
catchSo we're trying to avoid new deprecations in 8.9.x, but if contrib modules don't actually have to update for the change from jQuery UI to its replacement then there's no API change to worry about as such and I think patches could still land in 8.9.x, but it's probably going to depend a bit on what each patch looks like and how disruptive it might be. Also not sure how we handle BC when there are API changes either.
Comment #34
bnjmnmComment #36
catchComment #37
catchRe-reading this I think we can actually close this meta issue.
#2158943: Add a native dialog element to deprecate the jQuery UI dialog
#3076171: Provide a new library to replace jQuery UI autocomplete
#3113400: Deprecate more jQuery UI library definitions
All these are independently critical and have patches, the actual removal of jQuery UI will need to happen prior to Drupal 10 but each individual step has a well documented path forward now. I've also listed them on #3118149: [meta] Requirements for tagging Drupal 10.0.0-beta1.
Comment #39
catchThat was premature - there's new discussion on the awesomplete patch and the potential that #1899236: Add new Splitbutton render element to eventually replace Dropbutton could end up superseding it, so re-opening.
Comment #40
bnjmnmComment #42
xjmComment #43
xjmComment #44
xjmComment #45
bnjmnmComment #48
xjmI just moved the Autocomplete and Dialog issues to #3265680: Deprecate dependencies, libraries, modules, and themes that will be removed from Drupal 11 core. Since the rest of the work is completed, let's mark this fixed.
Comment #50
liquidcms commentedI see this is closed and yes, I get that jQuery UI is no longer part of core; but this issue had 2 parts:
1. Remove jQuery UI components used by Drupal core AND
2. replace with a set of supported solutions
Did #2 happen?
I see comments like Wim's in #27 that Tabs could be removed as its only use in Core was View UI. This is a bit scary and suggests part 2 of this may have fallen by the way side. Let's remember that utilities in core are not here to build core (as no one builds a web site with core) but to enhance Drupal as a framework for building applications.
Perhaps these have all been replaced? I do see a comment mentioning that collapse.js could be used for tabs. Any documentation on the full set of replacements (should be part of this issue)? jQuery UI certainly has excellent documentation.