Problem/Motivation

The bulk of the jQuery UI code in core was removed in #3087685: Remove deprecated jQuery UI components and fork remaining source code into core

Now that the source code is forked into core we can make additional changes to remove deprecated library definitions.

jquery.ui.controlgroup and jquery.ui.checkboxradio are dependencies of other core libraries, but we don't need to provide them as APIs in their own right.

Proposed resolution

Remove the library definitions from core.

Move the files from the library definitions into those of their dependents.

Remaining tasks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zrpnr created an issue. See original summary.

xjm’s picture

What is this issue postponed on?

zrpnr’s picture

Status: Postponed » Active
lauriii’s picture

It seems like most files are still a dependency for button.js. How can we remove these files while still keeping button.js?

It seems like form-min.js could be removed at least.

catch’s picture

Priority: Normal » Critical
Issue tags: +Drupal 9.0.0-beta1 requirement

Bumping to critical and tagging as a beta blocker. We either need to remove these, or undeprecate them and fork to core.

DamienMcKenna’s picture

jquery.ui.checkboxradio requires form-reset-mixin-min.js, so it can't be removed either, can it?

catch’s picture

Title: Follow-up to #3087685 Remove additional jQuery UI files » Remove deprecated jQuery UI library definitions
Status: Active » Needs review
FileSize
3.9 KB

OK I looked a bit more.

As @lauriii mentions these are dependencies of button.js, which is in turn a dependency of dialog.

Until dialog is removed, we can't remove button.js, and until button.js is removed, we can't remove the stuff it depends on.

However, we want to isolate the usage of these libraries to button.js and in turn dialog so that no new 9.x contrib modules end up using them for some reason. The contrib modules already exist for people who want to use them.

Deprecating them for 9.0.0 isn't correct, because we can't remove them in 9.0.0

Deprecating them from 10.0.0 isn't correct either, because we also can't remove them from 10.0.0 until dialog is replaced. Although it would be more correct.

But what we can do, is merge the library definitions into jquery.ui.dialog so that they no-longer exist independently at all. This allows us to clean up the deprecation listener.

If we do this, we need to properly deprecate button in Drupal 8.8/8.9 too. https://www.drupal.org/project/jquery_ui_button is already there just the deprecation message seems to be missing.

DamienMcKenna’s picture

I opened a new issue for deprecating the jquery.ui.button library: #3113250: Deprecate jquery.ui.button

Does it need to be marked as a 9.0.0-beta1 blocker?

Status: Needs review » Needs work

The last submitted patch, 7: 3098489.patch, failed testing. View results

catch’s picture

Status: Needs work » Needs review
FileSize
5.65 KB

Just missing deletion of the test I think, adding that to the patch.

@DamienMcKenna it'd be good to get confirmation from @lauriii that this is the direction we want to go here first, but if so then probably yeah we should.

DamienMcKenna’s picture

Paging Doctor lauriii :-)

lauriii’s picture

Issue tags: -Needs subsystem maintainer review
  1. Should we do this to jquery.ui.draggable, jquery.ui.mouse and jquery.ui.resizable as well since these are also only used by dialog?
  2. +++ b/core/core.libraries.yml
    @@ -446,60 +446,24 @@ jquery.ui.autocomplete:
    +    assets/vendor/jquery.ui/ui/widgets/dialog-min.js: { minified: true }
    ...
           assets/vendor/jquery.ui/themes/base/dialog.css: {}
    

    We should probably add the dialog files to the end of the list to ensure that the dependencies are loaded first.

  3. Should we handle removing form-min.js in a follow-up? Based on some earlier research on #4 it could be removed.
catch’s picture

#1. That makes sense and I added it to the patch below, but having done the work, I'm now thinking some of this might have to go into a follow-up. See explanation below.

jquery.ui.draggable already has a contrib module.

jquery.ui.mouse does not - it would need one if we're going to remove it.

jquery.ui.resizable also doesn't have a contrib project.

#2. Makes sense, also in the patch.

#3. I think it's a question of what we do with the jquery.ui library definition itself so it probably needs a follow-up - if you depend directly on jquery.ui you'll get that file. So it'd need its own change record maybe?

For libraries that aren't deprecated in 8.8/8.9 we actually have two choices here.

1. Mark them deprecated in 8.x for 9.x.

2. Keep the changes here that merge them into jquery.ui.dialog, mark the libraries deprecated in 9.x for 10.x. This still allows us to keep them out of skipped deprecations.

We should also open a follow-up to consider merging jquery.ui.autocomplete into drupal.autocomplete so that we can either deprecate or remove that definition too.

catch’s picture

OK this is a work in progress but is what I'm starting to think we should actually do here.

Apart from the already-deprecated libraries, it leaves the existing undeprecated library definitions intact, but it also adds their files to jquery.ui.dialog

I didn't copy over jquery.ui itself yet just because it's a lot of files :P

It would be nice to have been able to merge jquery.ui.dialog into drupal.dialog too, but the views_ui direct usage precludes this (unless we do something there too - maybe views_ui could declare a library definition directly referencing the files?).

If we like this approach, we could do the same for the rest of jquery.ui

For example jquery.ui.autocomplete is only used by drupal.autocomplete, so we could merge all of its files (and the files of its dependencies) into drupal.autocomplete, allowing us to properly deprecate jquery.ui.autocomplete, without adding anything to the deprecation skip list.

Apart from the views caveat mentioned above, this would allow us to fully deprecate all of the remaining jquery.ui.* definitions in core (whether for 9.x or 10.x removal).

If we're able to remove the jquery ui dependency from individual components in a bc-compatible way during the 9.x cycle, we could potentially even remove the files during the 9.x cycle as we go (or just leave them as cruft not referenced from a library definition).

lauriii’s picture

It would be nice to take this approach, but I'm concerned that this could be potentially disruptive if we don't first properly deprecate the libraries. This becomes relevant, especially if we merge jquery.ui.dialog into drupal.dialog, or jquery.ui.autocomplete into drupal.autocomplete because people could have replaced jQuery UI with something else. Setting proper deprecation warnings should be sufficient as long as we make sure that the change records explain properly what the changes are, and what the impact is.

The minimal scope of this issue could be to only make changes in the scope of already deprecated libraries, and then in a follow-up, discuss whether we should make some additional deprecations and removals or not.

catch’s picture

OK here's a patch for that, interdiff is against #10 - just fixes the file ordering.

catch’s picture

DamienMcKenna’s picture

lauriii’s picture

Status: Needs review » Needs work
Issue tags: +Needs followup

Let's remove the removal of jquery.ui.button from the patch since it's only being deprecated in #3113250: Deprecate jquery.ui.button.

We should also open follow-up for #12.3.

I was also considering if we should create change record for this issue or not. I checked https://www.drupal.org/node/3067969 and it seems like it covers this issue, so in my opinion we don't need a separate change record for this.

lauriii’s picture

bnjmnm’s picture

I'm now realizing it wasn't in the correct issue, but I have a patch that uses the approach suggested in #14 for the remaining libraries #3113400: Deprecate more jQuery UI library definitions. I won't add it to this issue's patch as it's not yet clear how much of that work will be done here vs. followups, but sharing here so it can be cherry picked if helpful.

Also re: contib modules#13

jquery.ui.mouse does not - it would need one if we're going to remove it.

jquery.ui.resizable also doesn't have a contrib project.

I have created contrib versions of every jQueryUI library that wasn't yet available.

https://www.drupal.org/project/jquery_ui_autocomplete
https://www.drupal.org/project/jquery_ui_dialog
https://www.drupal.org/project/jquery_ui_resizable

These currently are dev versions. I will promote to full release once they're reviewed.

Note that the libraries mouse, widget, position, and form-reset do not have dedicated contrib modules. They are included in the main jquery_ui module.

catch’s picture

Issue summary: View changes
Issue tags: +Novice

For this issue I think we only need to remove the hunk that is touching jquery.ui.button so that it's left in core and double-check the ordering of the merged library definitions. We can tackle jquery.ui.button in #3113400: Deprecate more jQuery UI library definitions.

Updated the issue summary.

Also tagging novice since updating the patch should be possible for a new contributor.

catch’s picture

Status: Needs work » Needs review
Issue tags: -Novice
FileSize
5.86 KB
1.47 KB

Here it is without jquery.ui.button removed.

catch’s picture

Follow-ups are open and issue summary is accurate.

longwave’s picture

Status: Needs review » Needs work
+++ b/core/core.libraries.yml
@@ -479,46 +483,24 @@ jquery.ui.button:
     - core/jquery.ui.checkboxradio
     - core/jquery.ui.controlgroup

These two dependencies no longer exist.

catch’s picture

Status: Needs work » Needs review
FileSize
388 bytes
5.85 KB

Good point.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks ready to go now assuming tests pass.

  • Gábor Hojtsy committed bf4e48d on 9.0.x
    Issue #3098489 by catch, lauriii, DamienMcKenna, zrpnr, longwave, bnjmnm...
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Superb, thanks all!

Status: Fixed » Closed (fixed)

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