Link dialog cannot be closed

Created on 28 October 2024, about 2 months ago

Problem/Motivation

In Drupal 10.3, when enabling ckeditor5_entity_browser the link dialog cannot be closed anymore. When clicking the dialog submit checkmark or close button the form closes, but the dialog itself is visible when selecting any text. even though it's not a link.

Proposed resolution

The problem is caused by overriding the linkUI._hideUI function. When the override is removed everything is working.

The reason this code exists in the first place is probably to close the dialog after selecting an entity. With the code removed the problem is now that a user has to click the submit checkmark twice.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium klaasvw

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

Merge Requests

Comments & Activities

  • Issue created by @klaasvw
  • Merge request !8Remove close link dialog override → (Open) created by klaasvw
  • 🇧🇪Belgium klaasvw

    The MR and attached patch removes the override.

    I haven't found another way to prevent having the click submit twice though. Contributions are welcome!

  • 🇳🇱Netherlands askibinski

    I tested a vanilla setup with 10.3.6 and 2.0.0 and can't reproduce any issues with the dialogs.

    That code actually exists to disable the LinkUI close method for the ckeditor popup when a drupal modal is open. When the modal is closed, it re-binds the original so you can close the first (ckeditor) link ui popup.

    Having said that, my original code for that looks pretty brittle, with a hardcoded class:

        linkUI._hideUI = () => {
          const modal = document.querySelectorAll('.ui-dialog-content');
          if (modal.length === 0) {
            _hideUIOriginal.bind(linkUI).call();
          }
        };
    

    And maybe in your case that class does not exist? In that case the re-bind wouldnt happen explaining your issue. I would welcome a patch/MR to improve this.

Production build 0.71.5 2024