dialogClass is deprecated in jQuery UI

Created on 18 December 2024, 4 months ago

Problem/Motivation

In commerce_add_to_cart_confirmation.js a dialog is created using Drupal.dialog(). In there a setting is used called 'dialogClass'. This sets a class called 'commerce-confirmation-popup' on the most outer div of the dialog html. In my custom theme I use this class for theming the dialog that this module produces.

After updating to Drupal 10.4.0, the dialog got displayed very different in my theme and it turns out that the class 'commerce-confirmation-popup' is no longer added to the dialog. While this might be a bug in Drupal core as it is supposed to be only deprecated (not removed), I think it would still be a good idea to fix the deprecation.

This issue from Drupal Core reports that it is deprecated: πŸ“Œ Trigger a JavaScript deprecation error for dialogClass in forked dialog.js Active .

And here are instructions for a replacement:
https://jqueryui.com/upgrade-guide/1.12/#deprecated-dialogclass-in-favor...

Steps to reproduce

  1. Update to Drupal 10.4.0
  2. Add a product to a cart to trigger the add to cart confirmation to show up.
  3. Inspect the HTML and notice that the CSS class 'commerce-confirmation-popup' is no longer added to dialog div.

Proposed resolution

Replace the usage of dialogClass with:

classes: {
  'ui-dialog': 'commerce-confirmation-popup'
},

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands megachriz

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024