[policy, no patch] Updating core JavaScript APIs gracefully.

Created on 27 October 2020, over 4 years ago
Updated 23 May 2025, about 2 months ago

Problem/Motivation

This is inspired by several current issues:

These issues are implementing large-but-necessary changes to core JavaScript. It is unlikely that any of these can be implemented in a manner that is 100% backwards-compatible or that provides full deprecation notice of changed/removed features, but it's also risky (and probably cruel) to only provide these changes to the Drupal 10 branch.

The issues listed above are likely the first of many, so it would be beneficial to come up with guidelines on how to implement these complex changes that can result in API changes.

Proposed resolution

While there's likely no one-size-fits-all solution for this, we should create a policy that will help us determine how a given change gets implemented.

Some approaches to consider (keeping in mind that no single approach will likely work for every change):

  • An optional module for replacing specific functionality, such as what is being done for autocomplete in πŸ“Œ Provide a new library to replace jQuery UI autocomplete Needs work , with dedicated modules for each new piece of functionality. Each module would be accompanied by deprecation notices when using the features they replace. Perhaps all of these modules can be categorized by a package name that indicates they are the modern replacements for specific functionality.
  • A single module that takes care of all JS replacements. This is similar to the previous option, but would simplify things by making it a single module (which has the drawback of making all replacement options unavailable, even if it's just one that is incompatible with a site)
  • Determining what level of BC support should be assured. For example, when replacing jQueryUI widgets, is it necessary to support BC for methods/config not used by core and no eveidence of being used by contrib? For something like Tabledrag, what is a reasonable BC expectation for contrib that extends it?

Things that need to be considered when evaluating an approach:

  • The dedicated module approach makes it easy to return to old functionality if compatibility issues arise, but also introduces the possibility of contrib having to support two versions of the same API.
  • What is a reasonable level of overhead for shimming features unused by Core and with no evidence of use in contrib. Although 100% BC support is the ideal, and the most virtuous hill to stand on, it can be at the expense of other Drupal advancements and bugfixes, and can introduce maintainability challenges to support functionality that has little to no use.
  • How granular should deprecation notices get? Methods with additional/now-unnecessary args, any no-longer-used config property?

There are likely more options and considerations than the above. There's a great deal to think about here. People should feel free to add these additional points to this issue summary.

Remaining tasks

πŸ“Œ Better define the backwards compatibility/API policy for JavaScript Active
Come up with some guidelines

🌱 Plan
Status

Postponed

Version

11.0 πŸ”₯

Component

javascript

Created by

πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024