Problem/Motivation

jQuery UI is being phased out from Drupal core: https://www.drupal.org/node/3064015

Deprecated unused jQuery UI asset libraries: https://www.drupal.org/node/3067969

Proposed resolution

We need to move to using https://www.drupal.org/project/jquery_ui_accordion instead of the core library to ensure a smooth transition to Drupal 9.

We need to ensure that when we do this, we require Drupal core 8.7.7 or later.

Remaining tasks

  1. Write patch.
  2. Review it.
  3. Manually test the upgrade ideally on actual sites,
    Steps:
    1. Install Drupal on each of these versions
      • Drupal <8.7.7
      • Drupal 8.8
      • Drupal 9
    2. Enable views_accordion and configure a view to use it.
    3. Then apply the patch and report what happens:
  4. Commit it and tag new 2.0.0 release

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

@TODO

CommentFileSizeAuthor
#36 3091388-36.patch6.67 KBManuel Garcia
#36 interdiff-3091388-19-36.txt3.65 KBManuel Garcia
#29 Screenshot 2020-05-13 at 1.52.33 PM.png481.42 KBmohrerao
#27 Screenshot 2020-05-12 at 7.47.20 PM.png719.57 KBmohrerao
#19 interdiff-3091388-18-19.txt2.98 KBsja112
#19 3091388-19.patch6.08 KBsja112
#18 interdiff_17_18.txt549 bytessja112
#18 3091388-18.patch3.36 KBsja112
#17 3091388-17.patch2.85 KBManuel Garcia
#17 interdiff-3091388-15-17.txt354 bytesManuel Garcia
#15 3091388-15.patch2.85 KBManuel Garcia
#15 interdiff-3091388-13-15.txt398 bytesManuel Garcia
#13 interdiff_6_13.txt782 bytessja112
#13 3091388-13.patch2.75 KBsja112
#12 interdiff_6_12.txt782 bytessja112
#12 3091388-12.patch0 bytessja112
#6 3091388-6.patch2.01 KBManuel Garcia
#6 interdiff-3091388-5-6.txt1005 bytesManuel Garcia
#5 3091388-5.patch1.03 KBManuel Garcia
#5 interdiff-3091388-4-5.txt314 bytesManuel Garcia
#4 3091388-4.patch739 bytesManuel Garcia
#4 interdiff-3091388-3-4.txt450 bytesManuel Garcia
#3 3091388-3.patch713 bytesManuel Garcia
#3 interdiff-3091388-2-3.txt300 bytesManuel Garcia
#2 3091388-2.patch661 bytesManuel Garcia
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Manuel Garcia created an issue. See original summary.

Manuel Garcia’s picture

Status: Active » Needs review
FileSize
661 bytes
Manuel Garcia’s picture

Manuel Garcia’s picture

FileSize
450 bytes
739 bytes

Let's try this again.

Manuel Garcia’s picture

Manuel Garcia’s picture

Finally progress, failure on #5 due to https://www.drupal.org/node/3083055

Manuel Garcia’s picture

Priority: Normal » Major
Kristen Pol’s picture

Assigned: Unassigned » Kristen Pol
Issue tags: +Drupal 9 patch day
Kristen Pol’s picture

Issue tags: +Drupal 9 compatibility
Kristen Pol’s picture

Assigned: Kristen Pol » Unassigned
Status: Needs review » Needs work

Thanks for the patch.

1) Reviewed the code:

  • +++ b/composer.json
    @@ -6,5 +6,8 @@
    +  "require": {
    +    "drupal/jquery_ui_accordion": "^1.0"
    +  },
    

    Not part of the change record instructions and is optional but ok to include per @berdir in #d9readiness Slack:

    https://drupal.slack.com/archives/CDDD98AMN/p1585592660080800?thread_ts=...

    changing composer.json is optional, it's enough to just change .info.yml if the module has no composer.json/no drupal/core requirement

  • +++ b/tests/src/Functional/ViewsAccordionTest.php
    @@ -14,6 +14,11 @@ class ViewsAccordionTest extends BrowserTestBase {
    +  protected $defaultTheme = 'stark';
    +
    +  /**
    +   * {@inheritdoc}
    +   */
    

    This was added to makes tests pass due to: #3082655: Specify the $defaultTheme property in all functional tests

  • +++ b/tests/src/FunctionalJavascript/ViewsAccordionTest.php
    @@ -16,6 +16,11 @@ class ViewsAccordionTest extends WebDriverTestBase {
    +  protected $defaultTheme = 'stark';
    +
    +  /**
    +   * {@inheritdoc}
    +   */
    

    Ditto.

  • +++ b/views_accordion.info.yml
    @@ -4,3 +4,6 @@ description: 'Provides an accordion views display plugin.'
    +  - jquery_ui_accordion:jquery_ui_accordion
    +test_dependencies:
    +  - jquery_ui_accordion:jquery_ui_accordion
    

    Looks good. Step 2 in change record: https://www.drupal.org/node/3067969

  • +++ b/views_accordion.libraries.yml
    @@ -3,4 +3,4 @@ views_accordion.accordion:
    -    - core/jquery.ui.accordion
    +    - jquery_ui_accordion/accordion
    

    Looks good. Step 3 in change record: https://www.drupal.org/node/3067969

2) Patch applied cleanly:

[mac:kristen:views_accordion]$ patch -p1 < 3091388-6.patch 
patching file composer.json
patching file tests/src/Functional/ViewsAccordionTest.php
patching file tests/src/FunctionalJavascript/ViewsAccordionTest.php
patching file views_accordion.info.yml
Hunk #1 succeeded at 5 with fuzz 1 (offset 1 line).
patching file views_accordion.libraries.yml

Note that I applied the patch on top of info file patch to see if they were compatible: https://www.drupal.org/project/views_accordion/issues/3100388#comment-13...

3) Reviewed Slack discussion regarding the new code breaking existing sites

https://app.slack.com/client/T06GX3JTS/CDDD98AMN/thread/CDDD98AMN-158806...

From @berdir:

you could include an update function to enable the new dependency automatically. anyone with composer will get the new dependency automatically and others should get an error on update.php about the missing dependency

and

new major version or not is up to you I guess

From @penyaskito:

depending on jquery_ui_accordion already forces you to use 8.7.7 or higher, as it doesn’t define core:8.x

Based on the above comments, adding the update hook is optional and doesn't have to hold up this patch.

4) Searched the code for jquery.ui.accordion after applying the patch and found it in:

./views_accordion.module:      $output .= '<h4>' . t('Choose <em>Views Accordion</em> in the <em>Style</em> dialog within your view, which will prompt you to configure the jquery.ui.accordion settings.') . '</h4>';

In the jQuery UI Accordion README file, it says:

2. Change any references in your theme or module from
`core/jquery.ui.accordion` to `jquery_ui_accordion/accordion`

so, although a nitpick, IMO this should be changed so moving back to "Needs work".

5) Other than #4, this looks RTBC to me but needs some manual testing for <8.7.7, 8.8, and 9.

Kristen Pol’s picture

Issue tags: -Drupal 9 patch day +Drupal 9 porting day

Whoops :)

sja112’s picture

Status: Needs work » Needs review
FileSize
0 bytes
782 bytes

Hi @kristen-pol,

Thanks for reviewing the patch. I have gone through your suggestions and accordingly fixed the 4th point and updated the patch.

Please review.

sja112’s picture

FileSize
2.75 KB
782 bytes

Hi @kristen-pol,

Thanks for reviewing the patch.

Please ignore the previous comment. Submitted the wrong patch file.

I have gone through your suggestions and accordingly fixed the 4th point and updated the patch 3091388-13.patch

Please review.

Manuel Garcia’s picture

Issue summary: View changes
Manuel Garcia’s picture

I've updated the IS with steps to test this patch, which is the last thing we need to do in order to ensure a painless transition.

Also I have been thinking about it and in order to test the upgrade we need to change our core version requirement on to core_version_requirement: ^8.7.7 || ^9, so doing so in this patch.

Status: Needs review » Needs work

The last submitted patch, 15: 3091388-15.patch, failed testing. View results

Manuel Garcia’s picture

Fixing this:

1) Drupal\Tests\views_accordion\FunctionalJavascript\ViewsAccordionTest::testViewsAccordion
Drupal\Core\Extension\InfoParserException: The 'core_version_requirement' constraint (^8.7.7 || ^9) requires the 'core' key not be set in modules/contrib/views_accordion/views_accordion.info.yml
sja112’s picture

Fixing this:

1) Drupal\Tests\views_accordion\Functional\ViewsAccordionTest::testViewsAccordion
Drupal\Core\Extension\InfoParserException: The 'core_version_requirement' key must be present in modules/contrib/views_accordion/tests/modules/views_accordion_test/views_accordion_test.info.yml
sja112’s picture

Fixing this:

Drupal\Tests\views_accordion\FunctionalJavascript\ViewsAccordionTest::testViewsAccordion
Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.
Using assertNotContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringNotContainsString() or assertStringNotContainsStringIgnoringCase() instead.
Kristen Pol’s picture

Looks like all remaining deprecations are being fixed here so I think we should change the title of the issue to reflect that but will see if @Manuel Garcia would like to weigh in on that.

Since the info.yml file fix is getting moved to here, adding the related issues but not closing it out yet until it's clear that this issue will handle all deprecations. If this will include the info.yml file, please add an issue credit here for @katherined.

Related issues:

#3100388: Drupal 9 compatibility
#3042793: Drupal 9 Deprecated Code Report

Manuel Garcia’s picture

Re #20: I agree, makes sense to me to merge both into this.

Added issue credit to @katherined here.

Manuel Garcia’s picture

Kristen Pol’s picture

Title: jQuery UI is being phased out from Drupal core » Fix deprecations including jQuery UI dependency and info.yml update

Took a stab at renaming the title.

Manuel Garcia’s picture

Ah yes, title looks good thanks @Kristen Pol. Closed the other issue now.

Kristen Pol’s picture

I checked the interdiffs for #13, #17, #18, and #19 and they all seem ok.

At this point, I think it's just manual testing that's needed.

mohrerao’s picture

Tested patch #19 on 9.1.0-dev. I'm seeing an error on console. Looks like there is still some dependency on jquery.
Attaching the screenshot.

mohrerao’s picture

Status: Needs review » Needs work
mohrerao’s picture

My Bad. Patch was not applied correctly on 9.1.0-dev. Tested again and works fine on 9.1.0-dev and ^8.8.x

mohrerao’s picture

Status: Needs work » Needs review
Kristen Pol’s picture

@mohrerao Thanks for testing on 8.8 and 9.1. Would you be able to follow the steps in the issue summary for Drupal <8.7.7? We want to make sure this update isn't going to break any existing sites.

mohrerao’s picture

@kristen, 3091388-19.patch cannot be tested on versions below 8.6 as we have addded core_version_requirement: ^8.7.7 || ^9 in the info.yml

Kristen Pol’s picture

Good point. I'm curious how it would complain if someone tried it on an older site though.

I see the failure in the tests for PHP 7 & MySQL 5.5, D8.7.

@Manuel Garcia Do you think this has been tested enough?

mohrerao’s picture

The better option would be to create a new version for D9 so that D8 sites can continue using the current version.

Kristen Pol’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing

@mohrerao There are maintainers that are doing that but many are making their D8 version compatible with D9. IMO you are correct and we don't need to test with < 8.7.7 because composer won't install this version of the module if they are on 8.7.7+.

Marking RTBC and @Manuel Garcia can chime in if this is enough testing.

Manuel Garcia’s picture

First of all, thank you @mohrerao very much for manually testing this, I believe with that, the version requirement and the dependency on the new jquery_ui_accordion contrib module it should be safe for this to go out.

However, the current patch fails if tested against 8.7.x, so the patch is not actually compatible with Drupal 8.7.7:

1) Drupal\Tests\views_accordion\FunctionalJavascript\ViewsAccordionTest::testViewsAccordion
Error: Call to undefined method Drupal\Tests\views_accordion\FunctionalJavascript\ViewsAccordionTest::assertStringContainsString()

/var/www/html/modules/contrib/views_accordion/tests/src/FunctionalJavascript/ViewsAccordionTest.php:95

I wonder if this situation is something core has a compatibility layer for, the failure is due core upgrading PHPUnit and although the module would work for the users, tests would fail for 8.7.7.

In any case, I had a think about this, and in order to move this forward I decided to refactor that part of the test in order to make it cross-version compatible, without using assertContains nor assertStringContainsString. Hopefully this will do the trick.

mohrerao’s picture

Issue tags: +DIACWMay2020
Gábor Hojtsy’s picture

Use event-appropriate tag (based on DIACWMay2020). (Sorry for the noise).

Luke.Leber’s picture

Manually tested against 9.0.x-dev - seems to work as expected.

Ran against drupal-check, shows no deprecations.

Patch #36 looks fine as well :)

jungle’s picture

Status: Needs review » Reviewed & tested by the community

#36, refactoring it is good workaround. I've worked on another similar one, #3126787: [D8 only] Add forwards-compatibility shim for assertInternalType() replacements in phpunit 6&7, there is no chance in core backporting them to 8.7.7 from my understanding. even It took some extra time of committers to make the decision backported them to 8.8.x finally.

+++ b/views_accordion.module
@@ -23,7 +23,7 @@ function views_accordion_help($route_name, RouteMatchInterface $route_match) {
+      $output .= '<h4>' . t('Choose <em>Views Accordion</em> in the <em>Style</em> dialog within your view, which will prompt you to configure the jquery_ui_accordion settings.') . '</h4>';

Perhaps, use "jQuery UI Accordion" is more applicable here, instead of machine name "jquery_ui_accordion", this can be fixed on committing if necessary.

Setting back to RTBC.

  • Manuel Garcia committed 204a691 on 2.0.x
    Issue #3091388 by Manuel Garcia, sja112, mohrerao, Kristen Pol,...
Manuel Garcia’s picture

Status: Reviewed & tested by the community » Fixed

I have now created a new 2.0.x branch and committed it.

Thank you all again for the help on this, much appreciated!

Manuel Garcia’s picture

Status: Fixed » Closed (fixed)

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