Problem/Motivation

Drupal 10.0.0 stable was released on: 15 Dec 2022 by the Drupal core team
https://www.drupal.org/project/drupal/releases/10.0.0


Thank you so much!

The current composer require status for this module under Drupal 10

composer create-project drupal/recommended-project:~10.0 /var/www/html/sandboxes/drupal10autocomplete_deluxe
cd /var/www/html/sandboxes/drupal10autocomplete_deluxe/

composer config minimum-stability dev

composer require drupal/autocomplete_deluxe;

Further drupal-check on

composer require drupal/core-dev --with-all-dependencies
composer require mglaman/drupal-check --dev
composer require phpspec/prophecy-phpunit:^2 --dev 

php vendor/bin/drupal-check -d web/modules/contrib/autocomplete_deluxe/

Output:

autocomplete_deluxe--drupal-check--report.txt

 4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


 [OK] No errors 

Proposed resolution

  • Support Drupal ~10 and change all deprecated packages, classes, functions, asset libraries to the Drupal 10 way
  • Real physical testing with Drupal ~10
  • Automated upgrade to Drupal ~10

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ✅ UX/UI designer responsibilities
  • ✅ Readability
  • ✅ Accessibility
  • ✅ Performance
  • ➖ Security
  • ➖ Documentation
  • ✅ Code review by maintainers
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release notes snippet
  • ✅ Release autocomplete_deluxe-2.0.3

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3277443 by Rajab Natshah: Support Drupal 10 and update all use of deprecation in the Autocomplete Deluxe module

Comments

Rajab Natshah created an issue. See original summary.

  • Rajab Natshah committed ce40d64 on 2.0.x
    Issue #3277443: Support Drupal 10 and update all use of deprecations in...
rajab natshah’s picture

Issue summary: View changes
Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Needs review » Needs work
Issue tags: +Drupal 10 compatibility
rajab natshah’s picture

Title: Support Drupal 10 and update all use of deprecations in the Autocomplete Deluxe module » Support Drupal 10 and update all use of deprecation in the Autocomplete Deluxe module
rajab natshah’s picture

Issue summary: View changes
StatusFileSize
new83 bytes
  • Composer install status: Working
  • Can be Enabled: Yes
  • Functional status: Still Not functional

Action: Needs to Fix styling and JS issues

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Using JQuery UI autocomplete.

    - core/jquery.once
    - core/jquery.ui.autocomplete
    - core/jquery.ui.button
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Switch from core/jquery.once to core/once and change the Drupal Autocomplete Deluxe behaviors

phpcs --standard=Drupal
rajab@vardot-dev:/var/www/html/products/autocomplete_deluxe$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,theme,scss,less,css,info,txt,md,yml,js /var/www/html/products/autocomplete_deluxe --ignore="/var/www/html/products/autocomplete_deluxe/node_modules/"

phpcs --standard=DrupalPractice
rajab@vardot-dev:/var/www/html/products/autocomplete_deluxe$ phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,theme,scss,less,css,info,txt,md,yml,js /var/www/html/products/autocomplete_deluxe --ignore="/var/www/html/products/autocomplete_deluxe/node_modules/"

  • Tested with Drupal 9 - under Claro and The Gin admin theme
  • Tested with Drupal 10 - under Claro and The Gin admin theme

Tested Autocomplete Deluxe widget under Drupal ~10.0 with Claro admin theme

Tested Autocomplete Deluxe widget under Drupal ~10.0 with Claro admin theme

Tested Autocomplete Deluxe widget under Drupal ~10.0 with The Gin admin theme - Light mode

Tested Autocomplete Deluxe widget under Drupal ~10.0 with The Gin admin theme

Tested Autocomplete Deluxe widget under Drupal ~9.0 with Claro admin theme

Tested Autocomplete Deluxe widget under Drupal ~9.0 with Claro admin theme

Tested Autocomplete Deluxe widget under Drupal ~9.0 with The Gin admin theme - Light mode

Tested Autocomplete Deluxe widget under Drupal ~9.0 with The Gin admin theme

rajab natshah’s picture

Tested Autocomplete Deluxe widget under Drupal ~10.0 with The Gin admin theme - Dark mode

Tested Autocomplete Deluxe widget under Drupal ~10.0 with The Gin admin theme - Dark mode

Tested Autocomplete Deluxe widget under Drupal ~9.0 with The Gin admin theme - Dark mode

Tested Autocomplete Deluxe widget under Drupal ~9.0 with The Gin admin theme - Dark mode

rajab natshah’s picture

#3277744: Actually remove deprecated jquery_ui libraries from core

jQuery UI Autocomplete deprecated in favor of @drupal/a11y_autocomplete library


#3076171: Provide a new library to replace jQuery UI autocomplete
Quick fix to switch from core/jquery.ui.autocomplete to jquery_ui_autocomplete/autocomplete by the jQuery UI Autocomplete module
jquery.ui.autocomplete:
  version: *jquery_ui_version
  license: *jquery_ui_license
  js:
    assets/vendor/jquery.ui/ui/widgets/autocomplete-min.js: { weight: -11.7, minified: true }
  css:
    component:
      assets/vendor/jquery.ui/themes/base/autocomplete.css: { weight: -11.7 }
  dependencies:
    - core/jquery.ui
    - core/jquery.ui.widget
    - core/jquery.ui.position
    - core/jquery.ui.menu
  deprecated: *jquery_ui_unused_deprecated

Quick fix to switch from core/jquery.ui.button to jquery_ui_button/button by the jQuery UI Button module
jquery.ui.button:
  version: *jquery_ui_version
  license: *jquery_ui_license
  js:
    assets/vendor/jquery.ui/ui/widgets/button-min.js: { weight: -11.5, minified: true }
    assets/vendor/jquery.ui/ui/widgets/checkboxradio-min.js: { weight: -11.6, minified: true }
    assets/vendor/jquery.ui/ui/widgets/controlgroup-min.js: { weight: -11.7, minified: true }
  css:
    component:
      assets/vendor/jquery.ui/themes/base/button.css: { weight: -11.5 }
      assets/vendor/jquery.ui/themes/base/checkboxradio.css: { weight: -11.6 }
      assets/vendor/jquery.ui/themes/base/controlgroup.css: { weight: -11.7 }
  dependencies:
    - core/jquery.ui
    - core/jquery.ui.widget
  deprecated: *jquery_ui_unused_deprecated

rajab natshah’s picture

Switching from core/jquery.ui.autocomplete to core/drupal.autocomplete
The core/drupal.autocomplete library is in Drupal 10 core.libraries.yml

drupal.autocomplete:
  version: VERSION
  js:
    misc/autocomplete.js: { weight: -1 }
    # The remaining JavaScript assets previously came from core/jquery.ui, a
    # deprecated library.
    # All weights are based on the requirements defined within each file.
    # @todo replace with solution in https://drupal.org/node/3076171
    assets/vendor/jquery.ui/ui/widgets/autocomplete-min.js: { weight: -11.7, minified: true }
    assets/vendor/jquery.ui/ui/labels-min.js: { weight: -11.7, minified: true }
    assets/vendor/jquery.ui/ui/widgets/menu-min.js: { weight: -11.7, minified: true }
    assets/vendor/jquery.ui/ui/data-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/disable-selection-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/focusable-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/form-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/ie-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/jquery-patch-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/keycode-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/plugin-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/safe-active-element-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/safe-blur-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/scroll-parent-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/unique-id-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/widget-min.js: { weight: -11.8, minified: true }
    assets/vendor/jquery.ui/ui/version-min.js: { weight: -11.9, minified: true }
  # All CSS assets previously came from core/jquery.ui, a deprecated library.
  # @todo replace with solution found in https://drupal.org/node/3076171
  css:
    component:
      assets/vendor/jquery.ui/themes/base/autocomplete.css: { weight: -11.7 }
      assets/vendor/jquery.ui/themes/base/menu.css: { weight: -11.7 }
      assets/vendor/jquery.ui/themes/base/core.css: { weight: -11.8 }
    theme:
      assets/vendor/jquery.ui/themes/base/theme.css: { weight: -11.8 }
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings
    - core/drupal.ajax
    - core/tabbable.jquery.shim
    - core/drupal.jquery.position
rajab natshah’s picture

Passing null to parameter #1 ($string) of type string is deprecated

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\autocomplete_deluxe\Controller\AutocompleteDeluxeController->handleAutocomplete() (line 24 of /var/www/html/products/autocomplete_deluxe/src/Controller/AutocompleteDeluxeController.php).
Drupal\autocomplete_deluxe\Controller\AutocompleteDeluxeController->handleAutocomplete(Object, 'taxonomy_term', 'default:taxonomy_term', 'FT3COcB_VH62Eq4_JEDBJT8RBMFfw2M-UvtePinSFvc ')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 681)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
rajab natshah’s picture

#3076171: Provide a new library to replace jQuery UI autocomplete
https://www.drupal.org/project/drupal/issues/3076171#comment-14652969

Lauri Eskola (lauriii) commented


Discussed this issue with @xjm because there were some concerns in regards to the fact that jQuery UI autocomplete library has been deprecated in core, and removed from Drupal 10. As a result of the conversation, she asked me to document the status quo on the issue.

We have deprecated the core/jquery.ui.autocomplete library definition and removed it from Drupal 10. jQuery UI autocomplete is loaded internally as part of the core/drupal.autocomplete library. This doesn't have an impact on the autocomplete PHP API. Also, jQuery UI customizations on Drupal Autocomplete are possible but only by explicitly extending the drupal.autocomplete library.

What is not possible and what we have wanted to deprecate is the option to initialize jQuery UI autocomplete directly without also either depending on drupal.autocomplete or jquery_ui_autocomplete contrib module.

There are some use cases in the grey area. For example, widget factory is a jQuery + jQuery UI functionality and allows overriding the core implementation. I guess technically folks overriding jQuery UI autocomplete with widget factory should depend on jQuery UI even if they are only overriding Drupal autocomplete functionality. However, this continues to work by extending core/drupal.autocomplete. This use case seems very much of an edge case and should not have too much weight on our decision.


rajab natshah’s picture

Changing

    - core/jquery.ui.autocomplete
    - core/jquery.ui.button

To

    - core/drupal.autocomplete
    - core/drupal.dialog
rajab natshah’s picture

Assigned: rajab natshah » mohammed j. razem
Issue summary: View changes
Issue tags: +autocomplete_deluxe-2.0.3
  • Switched from core/jquery.once to core/once and change the Drupal Autocomplete Deluxe behaviors
  • Switched from core/jquery.ui.autocomplete to core/drupal.autocomplete and from core/jquery.ui.button to core/drupal.dialog
  • Changed the header of the JavaScript file to jQuery, Drupal, once, drupalSettings, Sortable for the Autocomplete Deluxe widget
rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
rajab natshah’s picture

Status: Active » Fixed
rajab natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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

eiriksm’s picture

Hey there!

Thanks for your work on this. Just wanted to point out that with this issue resolved and released, this module is no longer compatible with drupal 8. Of course, Drupal 8 is not even supported, but it would be nice to also indicate this on the module page, composer.json file and info file. If people were to upgrade right now (which it does seem like they can) their autocomplete things will certainly stop working (since the once library only exists in drupal 9).

At this point it's unfortunately too late to mark the release 2.0.3 as not supported in drupal 8, but I would recommend doing so from now on, so the next release will be marked as such.

Do you want me to open a new issue / merge request for this?