Problem/Motivation
The Unlock dialog does not go away after clicking Unlock. There is an error in the Javascript console:
Uncaught TypeError: Cannot read properties of null (reading 'querySelectorAll') at HTMLDivElement.click (ui.js?rqwold:41:23) at HTMLButtonElement.<anonymous> (dialog.js:529:12) at HTMLButtonElement.dispatch (jquery.min.js?v=3.6.3:2:43336) at y.handle (jquery.min.js?v=3.6.3:2:41320)
Steps to reproduce
- Install stock Drupal 9.5.4 or 10.0.4. Claro is the installed admin theme.
- Configure the Title field of the Article content type to be locked
- Edit an article
- Click the Unlock field button
Expected behavior
Field should be unlocked, dialog dismissed.
Actual behavior
Although the field appears to be unlocked (if your screen is big enough to see behind the dialog), the dialog persists. Clicking the Unlock button again on the dialog does not dismiss the dialog, plus there is a Javascript error:
Uncaught TypeError: Cannot read properties of null (reading 'querySelectorAll') at HTMLDivElement.click (ui.js?rqwold:41:23) at HTMLButtonElement.<anonymous> (dialog.js:529:12) at HTMLButtonElement.dispatch (jquery.min.js?v=3.6.3:2:43336) at y.handle (jquery.min.js?v=3.6.3:2:41320)
Proposed resolution
The Drupal behavior that adds the Javascript functionality is being run multiple times, adding mutiple click event listeners to the unlock button, producing the unexpected results. We should use core/once to handle this correctly.
Remaining tasks
Patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork field_protect-3345580
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
m4oliveiComment #4
m4oliveiOpened a merge request, which:
I've tested on Drupal 9.3 w/ Seven, Drupal 9.4 w/ Claro and Drupal 10 w/ Claro. Looking good.
Comment #7
e0ipsoThis is great! Thank you very much!