Problem/Motivation
Following #3051352: [Plan] Remove unused jQuery UI components and replace with a suite of contrib packages for the continuous upgrade path we need to actually deprecate all the unused jQuery UI components in core, pointing to a change record which will in turn point to the contrib modules and how to update dependencies.
Proposed resolution
For jQuery UI components that are not used by core, deprecate them entirely in core and move them to contrib. This would be done via a set of contrib projects so that a security issue in one component doesn't require a security release for unrelated components.
Some utilities could be grouped under a main jquery_ui
project.
These modules could consist of an info and libraries file and the specific js or css currently in core/assets/vendor/jquery.ui
.
example folder structure:
jquery_ui_[component] |_jquery.ui | |_ui | | |_widgets | | |_[component]-min.js | | | |_themes | |_base | |_[component]-min.css | |_jquery_ui_[component].info.yml |_jquery_ui_[component].libraries.yml
example info file:
name: jQuery UI Droppable type: module description: 'Provides jQueryUI Droppable library.' package: jQuery UI core: 8.x dependencies: - jquery_ui - jquery_ui_draggable
The libraries file would be identical to what is currently in core.libraries.yml except for updated paths to files and dependent libraries.
Proposed list of modules, starting with the modules that can be currently marked deprecated:
- jquery_ui - this project page already exists but has not had activity since jQuery UI went into core. It would be great if we could use this as the namespace for this new module.
It could include jQuery "core" files as well as some utilities depended on by the other libraries.jquery.ui
jquery.ui.widget
(required by nearly all the other libraries)jquery.ui.mouse
(required by slider, selectable, draggable)jquery.ui.position
(required by selectmenu, tooltip)
-
jquery_ui_accordion -
jquery.ui.accordion
-
jquery_ui_button -
jquery.ui.button
- not in the deprecated list but required by spinner. -
jquery_ui_checkboxradio -
jquery.ui.checkboxradio
-
jquery_ui_controlgroup -
jquery.ui.controlgroup
-
jquery_ui_draggable -
jquery.ui.draggable
- not in the deprecated list but required by droppable. -
jquery_ui_droppable -
jquery.ui.droppable
-
jquery_ui_effects - since the individual effects depend on jquery.ui.effects.core it's more convenient to package them together.
jquery.ui.effects.core
jquery.ui.effects.blind
jquery.ui.effects.bounce
jquery.ui.effects.clip
jquery.ui.effects.drop
jquery.ui.effects.explode
jquery.ui.effects.fade
jquery.ui.effects.fold
jquery.ui.effects.highlight
jquery.ui.effects.puff
jquery.ui.effects.pulsate
jquery.ui.effects.scale
jquery.ui.effects.shake
jquery.ui.effects.size
jquery.ui.effects.slide
jquery.ui.effects.transfer
-
jquery_ui_menu -
jquery.ui.menu
- not in the deprecated list but required by selectmenu. -
jquery_ui_progressbar -
jquery.ui.progressbar
-
jquery_ui_selectable -
jquery.ui.selectable
-
jquery_ui_selectmenu -
jquery.ui.selectmenu
-
jquery_ui_slider -
jquery.ui.slider
-
jquery_ui_spinner -
jquery.ui.spinner
-
jquery_ui_tabs -
jquery.ui.tabs
-
jquery_ui_tooltip -
jquery.ui.tooltip
Remaining tasks
None.
User interface changes
None.
API changes
A number of jQuery UI asset libraries are deprecated. See the change record and proposed resolution.
Data model changes
None.
Release notes snippet
jQuery UI asset libraries that are not used by Drupal core have been deprecated and will be removed in Drupal 9.0, because jQuery UI is end-of-life and no longer receives security coverage. The libraries have been provided as contributed modules for a simple Drupal 9 upgrade path for any module or theme that requires them, but it is recommended to find a different solution in the longer term. See the change record on the deprecated jQuery UI libraries and their replacement modules for more information.
Comment | File | Size | Author |
---|---|---|---|
#57 | 3067251-57.patch | 20.58 KB | lauriii |
#45 | 3067251-45.patch | 20.44 KB | zrpnr |
#41 | interdiff_39-41.txt | 981 bytes | zrpnr |
#41 | 3067251-41.patch | 20.13 KB | zrpnr |
#39 | interdiff_17-39.txt | 2.11 KB | zrpnr |
Comments
Comment #4
catchInitial patch originally from #3064017: Create a means to mark an asset library as deprecated in a *.libraries.yml file, also crediting people from that issue.
Comment #6
catchComment #7
zrpnrI made a start on this suite of modules:
They all depend on a core jquery_ui lib which I think could be on the 8.x branch of the existing jquery_ui module.
Comment #8
catchNice work creating all the projects. I failed to upload the patch for #4.
Comment #9
catchComment #11
zrpnrI think that test failed only because of one word in the description, "from drupal:9.0.0" --> "in drupal:9.0.0". Uploading a new version of that patch to see if it passes testbot now.
Comment #12
zrpnrmarking "needs review"
Comment #13
Wim Leers#7: woah, nice work!
#11:
What does
mean?Is it
core/jquery.ui
? Or is it one of these contrib modules? Should this particular example not point tohttps://www.drupal.org/project/jquery_ui_effects
now?Comment #14
zrpnrI wanted to get that test to pass first, and also I wasn't sure if it was a good idea since those new modules don't have a proper release yet.
Here's a patch with all the libraries @lauriii marked deprecated in https://www.drupal.org/project/drupal/issues/3051352
Updated the wording on all those libraries per your suggestion @wim.leers and added tests.
Comment #15
catchI think we should link to the change record, and from there to the modules rather than directly referencing contrib modules in the deprecation message. The deprecation message is for contrib/custom code maintainers rather than site admins, who'll need to change their dependencies as well as install.
Comment #16
Wim Leers#15 works for me too :) Sorry for the unnecessary work in #14, @zrpnr!
Comment #17
zrpnrThat does seem better, and a lot simpler!
I posted a draft change record and updated the patch for core.libraries.yml and the tests.
Comment #18
zrpnrComment #19
mikelutzI got the 8.x-1.x-dev branch of jquery_ui up and running, will tag a release in the next day or two.
Comment #20
Wim Leers👏👍
Too bad we can't use
setExpectedDeprecation()
much likesetExpectedException()
, that'd allow us to massively simplify this test :)jquery.ui.effects.scale
,jquery.ui.effects.shake
,*.size
,*.slide
and*.transfer
. Added those to the change record. Those were the only things that were not in sync between the issue summary, the change record and the patch.Comment #21
xjmI made some small improvements to the CR including switching the order of the columns so that the "before" is more intuitively the first column.
info.yml
and an example of a place where the library is registered for use).Thanks!
Comment #22
Wim LeersGood remarks. I should've indicated that my RTBC was conditional: I agree that this cannot be committed until the contrib projects exist and have stable releases — but I felt it was important to get release manager feedback on the patch's overall approach. I should've used the tag instead, I think?
Comment #23
zrpnrThank you for the comments and edits @Wim and @xjm!
Doing manual testing led me to https://www.drupal.org/project/drupal/issues/2926155, I posted a patch there for the current core asset libraries and made the same fix in the contrib modules.
I think this is ready for another look but I also understand (from #21 and #22) it can't be RTBC until these contrib modules are approved and stable.
Comment #24
Wim LeersSorry for the long silence here! :( This was a lower priority than some other issues, but we better get this wrapped up! Mea culpa.
RE: "manual testing led me to #2926155: Follow-up to #2809427: update from jQuery UI 1.11.4 to 1.12.1 forgot to list some new JS files in *.libraries.yml" — we got that fixed several weeks ago! 🥳
But 🤔 … there is one problem in the change record. It says: #474684: Allow themes to declare dependencies on modules. I'd love to be able to dismiss this as an extremely rare edge case, but I don't think we can: http://grep.xnddx.ru/search?text=core%2Fjquery.ui&filename=.info.yml shows it's pretty common for themes to be overriding CSS assets in jQuery UI asset libraries and to be extending jQuery UI asset libraries with additional CSS assets.
The former is true, the latter is not: themes cannot declare a dependency on a module — that's still a work in progress atIf it would be only
libraries-extend
andlibraries-override
in themeinfo.yml
files and those would only have effect when the extended or overridden asset libraries actually existed, it would not be a problem.But
\Drupal\Core\Asset\LibraryDiscoveryCollector::applyLibrariesExtend()
throwsInvalidLibrariesExtendSpecificationException
for non-existent asset libraries that are being extended.I see only two ways forward:
jquery_ui*
contrib modules must be declared by themes.libraries-extend
orlibraries-override
declaration involving jQuery UI asset libraries tohook_library_info_alter()
implementations instead.I think we should go with the second approach, because the first is not at all certain to succeed, and we don't want this critical issue to be blocked unnecessarily. If #474684 then still lands, we can still refine the change record.
Deprecated Libraries Example
module that @zrpnr created. (I made one pull request: https://github.com/zrpnr/deprecated_libraries/pull/1.) It works fine :) This indeed made it very easy to verify what @xjm asked to verify in #21.4 — thanks!Keeping at
, tagging and moving to because we really need one and preferably multiple Theme API maintainers to chime in on point 2!Comment #25
lauriii#24.2 Certainly brings up an interesting problem. The exception described there isn't actually triggered as a result of extending non-existing libraries because the library extends are processed based on existing libraries in
\Drupal\Core\Asset\LibraryDiscoveryCollector::applyLibrariesExtend()
.It seems like this doesn't happen for the libraries overrides either. This is due to the way library overrides are being parsed in:
Drupal\Core\Asset\LibraryDiscoveryParser::applyLibrariesOverride
. I can't find explicit test coverage for this anywhere but this is fairly easy to test manually.This does bring up another problem though. At the moment themes could implement features requiring jQuery UI. Since themes cannot define dependencies on modules, there's no way for them to reliably depend on jQuery UI after we've removed jQuery UI from core. I talked to @Wim Leers and we agreed that there aren't any good solutions available to this, other than solving #474684: Allow themes to declare dependencies on modules. However, I'm fairly confident that this affects only a handful of sites. Making this issue postponed on #474684: Allow themes to declare dependencies on modules would increase the risk of having to ship Drupal 9 with most if not all jQuery UI components, therefore I recommend that we bump #474684: Allow themes to declare dependencies on modules to critical, but not make it a hard blocker to this.
Comment #26
Wim LeersPerhaps to prove this we can just add explicit test coverage for this aspect here? :)
Comment #27
catchI don't think #474684: Allow themes to declare dependencies on modules should block this fwiw.
Comment #28
Wim LeersPer #25 and #27, marking for adding explicit tests that show
libraries-override
andlibraries-extend
in themes'info.yml
files do not trigger exceptions or errors — they just don't have any effect in that case.Note that explicit unit test coverage for this does exist at
LibraryDiscoveryIntegrationTest::testLibrariesExtend()
(assertsInvalidLibrariesExtendSpecificationException
is thrown) andLibraryDiscoveryIntegrationTest::testLibrariesOverride()
. But @lauriii is saying that in real world circumstances, you will never see any actual errors, because those unit tests are performing calls that the actual theme/render/asset library system never perform.So the missing test coverage is to make a test theme that overrides a non-existent asset library and extends a non-existent asset library, asserts no errors occur, and then a module is installed that makes those non-existent asset libraries suddenly exist, now the observed behavior should be that the
libraries-override
andlibraries-extend
declarations do have an effect.Comment #29
lauriiiLooking at the exceptions again, it seems like the exceptions and the unit tests are for a use case where libraries-extend is extending an existing library with a non-existing library.
Example code that would trigger this exception:
It's probably still worthwhile to add explicit test coverage for this, but I don't think we should block this issue on that either. We have lots of libraries-overrides overriding libraries added by modules that could be disabled and we haven't seen any bug reports related to that.
We should update the change records to explicitly include instructions to how themes should handle these deprecations.
Comment #30
Wim LeersWFM! 👍
(I just advocated for explicit tests to get 100% confidence. If a Theme API maintainer and frontend committer already feels 100% confident, I'm totally fine with that of course 😃)
Comment #31
catchI also think we should add the explicit test coverage in a follow-up rather than blocking this issue.
Comment #32
lauriiiOpened follow-up with @zrpnr: #3078402: Follow-up to #3067251: Add additional test coverage to assets system.
Comment #33
Wim Leerslibraries-extend
andlibraries-override
throwing exceptions (see #25 + #28 + #29). The follow-up that we identified we needed (in #29) was filed (in #32).So all that remained here was updating the change record. Did that: https://www.drupal.org/node/3067969/revisions/view/11543530/11552019.
I should've written more explicitly in #24.4 that I think the contrib modules are ready. Per @xjm #21, this cannot be RTBC until those modules have stable releases. I think adding those stable releases is the only remaining task here before this is RTBC.
@zrpnr, back to you!
Comment #34
zrpnrComment #35
zrpnrThere are now stable releases for all these contrib modules, as well as the revived jQuery UI project.
I updated the IS and the change record to include jQuery UI Tabs, which was added to this list of asset libraries after @lauriii fixed #3070369: Remove Drupal\views_ui\ViewEditForm::form dependency to jQuery UI tabs
Comment #36
catchI think that means this can be RTBC again.
Comment #37
Wim Leers🥳
Comment #38
lauriiiComment #39
zrpnrRerolled #17, added test for jquery.ui.tabs deprecation.
Comment #41
zrpnrFailed successfully! At least that shows the deprecation warnings work...
This is because of #2926155: Follow-up to #2809427: update from jQuery UI 1.11.4 to 1.12.1 forgot to list some new JS files in *.libraries.yml which audited and fixed the jQuery UI asset library dependencies, now
checkboxradio
andcontrolgroup
are dependencies ofbutton
which in turn is used bydialog
.If #2158943: Add a native dialog element to deprecate the jQuery UI dialog lands we can mark button deprecated as well, and it should be safe to ignore the warnings for
checkboxradio
andcontrolgroup
in the meantime.Added those 2 deprecation messages to
DeprecationTrait::getSkippedDeprecations
.Alternatively, I could un-deprecate
checkboxradio
andcontrolgroup
.Comment #42
Wim LeersI think #41's approach of skipping those two deprecations by adding them to
\Drupal\Tests\Listeners\DeprecationListenerTrait::getSkippedDeprecations()
is acceptable because those asset libraries will disappear in Drupal 9 anyway. And they’re new in Drupal 8.8 (the aforementioned #2926155: Follow-up to #2809427: update from jQuery UI 1.11.4 to 1.12.1 forgot to list some new JS files in *.libraries.yml introduced them).In theory, we shouldn't add more "skipped deprecations", but in this case there will not be any code changes needed in Drupal 9.
Using this approach allows us to still deprecate all of the relevant asset libraries.
Comment #43
xjmLovely work on this issue. I'm so happy to see it RTBC!
I'd like to take some time to review things here and talk it over a bit with other committers, so tagging for RM review for now.
Comment #44
zrpnrPatch failed to apply
Comment #45
zrpnrRerolled against 8.8.x, there were a couple new messages in
getSkippedDeprecations
which prevented the patch in #41 from applying.Line numbers changed in core.libraries.yml.
Comment #46
Wim LeersFeel free to re-RTBC yourself in case of a straight rebase 😊
Comment #49
xjmOK so I remember now what I wanted to ask about when I assigned this to myself a couple weeks ago: Now that we know for sure we're going to be retaining at least
dialog
anddraggable
in core for BC in 9.0.0, is it still correct for those modules to have a dependency on a contrib jQuery UI module?Reasoning: When core forks
dialog
anddraggable
for BC in 9.0.0, we'll also need to fork the base jQuery UI API. Thus, the library will be in core anyway. Now say you also use jQuery UI Accordion. If the contrib module declares a dependency on a contrib copy of the base API, you now have two copies of it on your site (both of which will need security updates and etc.).So, given all that, should we remove the contrib dependency from the contrib modules?
Alternately, we could retain the contrib module, but just have it declare a dependency on the core library that forks jQuery UI, instead of retaining its own copy. That's less work, and also probably more future-compatible when we get all of the remaining jQuery UI code out of core in Drupal 10.
Comment #50
catchThis seems like probably a better option. If that's the case I think we also don't need to make any changes here?
The last patch got marked needs work, but it's actually still green in the UI here, so moving back to needs review for a retest to see what's up.
Comment #51
xjmWe should also confirm what we should be doing in terms of documenting the licenses and copyrights. See #3087886: [policy, maybe patch] core/COPYRIGHT.txt is inconsistent in which libraries or copyrights are mentioned. In core, the libraries both retain the license info in their docblock and have an entry in
core/COPYRIGHT.txt
(even though not all asset libraries do). In the contrib modules though we don't have any such copyright info documented in the project root.Comment #52
zrpnrI posted an update on the 8.x-1.x branch of jquery_ui that removes all the js and css files from jquery_ui.libraries.yml and adds a dependency to the core asset libraries.
https://git.drupalcode.org/project/jquery_ui/commit/7f5d09ee219b849bb691...
Removed the form-reset library there too since those files are now added directly to the modules that need them, IIRC that was the only remaining difference in the contrib project.
This would be an even cleaner solution if #2905429: Library definitions containing only dependencies should be valid lands! :)
Comment #53
zrpnrThere's now a stable release for the contrib jquery_ui with the change mentioned in #52
I also posted new release for jquery_ui_checkboxradio and jquery_ui_selectmenu since they depended on a file that was previously provided in the contrib jquery_ui module.
Comment #54
tedbowThe changes to jquery_ui look good. There was 1 small problem and @zrpnr fixed it.
Here is the 2 commits https://git.drupalcode.org/project/jquery_ui/compare/5f653b11df0c2925dcb...
also update to jquery_ui_selectmenu
https://git.drupalcode.org/project/jquery_ui_checkboxradio/commit/dc727c...
and jquery_ui_checkboxradio
https://git.drupalcode.org/project/jquery_ui_checkboxradio/commit/dc727c...
Look good. these were both just changes to not depend on
jquery_ui/form-reset
but pull in theform-reset-mixin-min.js
file directly which is what core is doing.Comment #55
catchOK I think the changes to the contrib module means this can be committed to core properly now. Back to RTBC!
Comment #56
xjmWe filed #3088434: Update license and copyright info to address the bit about the copyright documentation, but that doesn't need to block the core commit since it does not affect the upgrade path.
Comment #57
lauriiiRerolled #45 🐣
Comment #61
xjmComment #62
xjmCommitted to 9.0.x, 8.9.x, and 8.8.x, and published the change record. YAY! Drupal 9 JavaScript just got a lot more maintainable and future-compatible.
Comment #63
xjmComment #65
mondrakeJust a note about the fact that the contrib modules cannot install under Drupal 9.0.x, see #3097631: Cannot install with Drupal 9.0.x
Comment #66
xjm