Problem/Motivation
webform.element.color.js calls jQuery UI's $.fn.uniqueId() to assign an id to the generated color-output input. uniqueId() is a jQuery UI method, not part of jQuery core. Drupal 11 ships jQuery 4, which drops the old jQuery UI method shims, so on any page that renders a webform color element the script throws uniqueId is not a function and the color output field is never enhanced.
The call is still present in 6.2.x and 6.3.x. #3512816: jQuery.isFunction is removed in jQuery 4.0+ fixed $.isFunction in another file but didn't touch this one.
Steps to reproduce
On a Drupal 11 site, add a color element to a webform and view the form. The console shows the TypeError and the color output field doesn't render.
Proposed resolution
Replace the single uniqueId() call with a module-local incrementing counter to generate the id. Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| webform-color-element-jquery4-uniqueid.patch | 1.1 KB | dylan donkersgoed |
Issue fork webform-3605746
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liam morlandThanks for the patch. Please create a merge request.
Comment #3
liam morlandComment #6
charlliequadros commentedHi @liam morland,
I made a small change to the patch: instead of using ++webformColorOutputId, I changed it to webformColorOutputId += 1.
I made this change because ESLint may generate a warning for the use of ++, so I thought it would be better to avoid introducing that warning. I also separated the code a little more to improve readability.
Comment #7
charlliequadros commented