Drupal 10.4 breaks progressbar; prevents batch from completing. Library overrides not working.

Created on 1 January 2025, 21 days ago

Problem/Motivation

The core/misc/progressbar.js file changed between drupal 10.3 and 10.4 (and probably 11.0 to 11.1). It moved some progress bar code to this file. That code is now missing from the progressbar.js override included with radix.

A secondary issue is that radix has two copies of its customized progressbar.js. One is in the progressbar component directory and the other is in the overrides directory. The library file refers to the overrides directory, but Single Component Directory seems to load the one from the component directory.

Steps to reproduce

View any batch operation with a progress bar. Observe the browser console and see the error that Drupal.progressBar is missing.

Proposed resolution

For an immediate resolution, to get sites working again, delete progress.js from the components/progressbar.

The code that is missing from the overrides/progress.js is:

  /**
   * A progressbar object. Initialized with the given id. Must be inserted into
   * the DOM afterwards through progressBar.element.
   *
   * Method is the function which will perform the HTTP request to get the
   * progress bar state. Either "GET" or "POST".
   *
   * @example
   * pb = new Drupal.ProgressBar('myProgressBar');
   * some_element.appendChild(pb.element);
   *
   * @constructor
   *
   * @param {string} id
   *   The id for the progressbar.
   * @param {function} updateCallback
   *   Callback to run on update.
   * @param {string} method
   *   HTTP method to use.
   * @param {function} errorCallback
   *   Callback to call on error.
   */
  Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) {
    this.id = id;
    this.method = method || 'GET';
    this.updateCallback = updateCallback;
    this.errorCallback = errorCallback;

    // The WAI-ARIA setting aria-live="polite" will announce changes after
    // users
    // have completed their current activity and not interrupt the screen
    // reader.
    this.element = $(Drupal.theme('progressBar', id));
  };

However, I'm not sure that the radix.libraries is set up correctly. I assume the core libraries are intended as replacements, and they are not written as described using libraries_override as described in the release note: https://www.drupal.org/node/2497313 β†’

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

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

Comments & Activities

  • Issue created by @danchadwick
  • πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

    Here's a patch to just delete progress.js from the components in order to get sites working again with D10.4

  • πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston
  • πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

    Since the identical progress.js appears in both the components/progressbar and the src/js/overrides directories, I simply deleted the one in the components directory. For reasons I have not researched, the presence of this version in the SDC prevented the core misc/progress.js from being loaded, leading to the javascript error and failure of batch operations.

    With the overrides loaded in the info.yml file via libraries-extend, both the core and the radix version of this file are loaded. The core version supplies the Drupal.ProgressBar function.

    This issue's resolution should make radix compatible with Drupal 10.4 and 11.1 when using progress bars. Please re-open if there are compatibility issues with earlier versions.

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

Production build 0.71.5 2024