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

CommentFileSizeAuthor
#2 radix_progress-3496797-2.patch3.15 KBdanchadwick

Comments

danchadwick created an issue. See original summary.

danchadwick’s picture

StatusFileSize
new3.15 KB

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

danchadwick’s picture

Title: Drupal 10.4 breaks progressbar; prevents batch from completing. Library overrides not working. » Drupal 10.4 breaks progressbar; prevents batch from completing.
Issue summary: View changes

  • danchadwick committed 19af6119 on 6.0.x
    Issue #3496797 by danchadwick: Drupal 10.4 breaks progressbar; prevents...
danchadwick’s picture

Status: Active » Fixed

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.

Status: Fixed » Closed (fixed)

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