Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293174

Provide a new library to replace jQuery UI autocomplete

$
0
0

Before going any further, know this:

Much of the work on this task took place here: #2346973: Improve usability and accessibility of long select lists. It eventually became apparent that this needed its own issue

  • Are you looking for the issue regarding a drop-in replacement for jQuery UI autocomplete, for stuff like entity reference fields? this is that issue
  • Are you looking for the issue regarding UX improvments to <select> elements, making it easier to deal with long lists of options? That is a different issue, and it is here: #2346973: Improve usability and accessibility of long select lists

Problem/Motivation

We are in the process of deprecating jQuery UI in core. jQuery UI's autocomplete is among the components that need to be removed/replaced.
As mentioned in the parent issue: #3067261: [Plan] Remove jQuery UI components used by Drupal core and replace with a set of supported solutions
The OpenJS Foundation 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

Well before the need to deprecate jQueryUI emerged in mid-2019, there has been interest in replacing jQueryUI with something with better UX and accessibility (which is evident in this issue being created several years prior to mid-2019).

Proposed resolution

First, some context regarding the decisions made in this specific resolution

Because it was clear the new autocomplete would not be fully backwards compatible with jQuery Ui autocomplete, it was decided to introduce the new Autocomplete as an experimental module and leave jQuery UI autocomplete as the default until Drupal 10. This would provide sites with adequate time to make any changes required

The original plan for this was to replace jQuery UI with another library. Awesomplete was literally the only library without significant accessibility regressions compared to jQueryUI and one that could be added with the least disruption so that was the library we chose.

It was then observed that the amount of customization required for the Awesomplete implementation was significant enough that we were using very little of the library itself, and it may be simpler to make the solution entirely custom.

Then after that, it was observed that this new autocomplete may be a good candidate for being a standalone library that doesn't depend on Drupal, which would adhere to the policy here: #3176918: [policy, no patch] Publishing / Maintaining JS libraries produced by Drupal that do not have a dependency on Drupal

With that context out of the way, this is the current proposed solution

How it will work in Drupal:
  • Create a new A11y_autocomplete standalone npm package that can work independent of Core.
  • A11y_autocomplete will be added to /vendor. It will replace the jQuery UI autocomplete library. There will be a backwards-compatible shim that translates any jQuery UI autocomplete usages to work with A11y_autocomplete.
  • When the shim is used, deprecation warnings will be triggered.
  • The shim also needs to provide Backwards compatible markup
  • The shimmed (backwards compatible with jQuery UI) autocomplete will be the default autocomplete. The non-shimmed can be used by setting #use-core-autocomplete to true on the form element render array.
  • Drupal-specific functionality such as calls to Drupal.t() and Drupal.announce() will take place in a different file. Class methods will be overridden as needed.
  • Accessibility implementation will use Accessible Autocomplete from GOV.UK as reference, as it was informed by extensive testing and research. (the accessible autocomplete library was not an option as something Drupal could use as the feature set did not cover what core would need from an autocomplete.

Steps taken prior to the proposed resolution

Several other options were evaluated. Note that all links to evaluations go a separate issue: #2346973: Improve usability and accessibility of long select lists, the issue that this originated from.

Other than Awesomplete, nontrivial accessibility problems identified in each evaluation. These problems were discovered from general accessibility testing. In each case, enough issues were found that it wasn't worth devoting additional time to strictly checking against W3 specs.

Remaining tasks

  • Accessibility review
  • JS review
  • FE Manager review
  • UX review
  • Product Manager review
  • (probably more reviews, this is a major change)

User interface changes

Yes.

API changes

Yes.

Release Notes Snippet

A new experimental module, Drupal Autocomplete, has been added. It replaces the functionality provided by jQuery UI Autocomplete, as jQuery UI has reached end-of-life. The functionality provided by this module will be default in Drupal 10, so we encourage all sites to enable this module as soon as possible. Sites that have no autocomplete customization should be able to enable this module with zero disruption. Sites that do customize autocomplete behavior should use this module to prepare their site for Drupal 10.


Viewing all articles
Browse latest Browse all 293174

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>