Problem/Motivation
If a form has a CKEditor 5 text area on a form and also has some action that opens a dialog with a different CKEditor 5 text area, the modal dialog doesn't function 100%. At least, but maybe not limited to, the link button in the dialog does not work at all.
I confirmed this issue on Drupal 9 and Drupal 10 branches.
Steps to reproduce
- install standard profile
- add
$settings['extension_discovery_scan_tests'] = TRUE;to the settings file - Enable ckeditor5_test module
- Modify
\Drupal\ckeditor5_test\Controller\CKEditor5DialogTestController.phpinto a form like\Drupal\ckeditor5_test\Form\CKEditor5DialogTestForm - Add a text_format element above the original link element
- view the route /ckeditor5_test/dialog
- Verify the link in the initial CKEditor works fine
- Open the dialog by clicking the "Add Node" link
- Verify the link in the dialog CKEditor doesn't work at all
Proposed resolution
Remaining tasks
User interface changes
None
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | 10.5-3351603-42.patch | 462 bytes | vijaycs85 |
| #34 | CKEDITOR.gif | 17.54 MB | saurav-drupal-dev |
| #30 | 3351603-30.patch | 550 bytes | nginex |
| #29 | cke-balloon-panel-tooltip-z-index-3351603-29.patch | 438 bytes | fathima.asmat |
| #28 | tooltips-z-index.png | 18.21 KB | bkosborne |
Issue fork drupal-3351603
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
pookmish commentedWhile attempting to build out a test and reproduction branch, I found that the link input field is actually generated, but it's behind the dialog. setting the element `.ck-balloon-panel` to a large z-index brought the element back into view.
specifically a z-index of 1261 worked.
Comment #3
pookmish commentedComment #4
pookmish commentedSetting to needs review to trigger tests
Comment #5
smustgrave commentedBuild failure in #3
If you were trying to trigger the tests you can click Add test/ retest below the patch to manually trigger.
Comment #6
akram khanadded updated patch and try to fix CCF #3
Comment #7
daniel.pernold commentedSame here, the problem also occurs when using CKEditor5 inside a paragraph overlay using layout_paragraphs module.
The same environment with the same settings inside a normal "article" (without additional modules) is working.
Comment #8
stpaultim commentedA client just reported this problem to us as well. Has anyone had any success with a patch?
Comment #9
pookmish commentedI just added a little css to my CKEditor5 stylesheet which solved it for me.
.ck.ck-balloon-panel {
z-index: 1300 !important;
}
Comment #10
caspervoogt commentedI ran into the same thing and #9 helped me.
#7 mentions Paragraphs. In my case I was editing a node and not using Paragraphs.
Comment #11
wim leersComment #12
yellowknight commented#9 did the trick. It resolved an issue with Linkit and Media. Thanks.
Comment #13
pierreemmanuel commentedHi,
I have quite the same issue, add link does not show the balloon, but media dialog replaces the the current dialog. Here is the setup :
A custom CKE5 plugin call the node add form to create a node within a CKE5 field :

As soon as I tried to use media plugin to insert a media, the media dialog replace the current dialog (which is the node creation form), this I am not able to insert the media since the form is closed.

I tried both CSS and the dialog dependency fix but I think the issue is more like the plugin does not see the "child" CKE5 in the form but only the "parent" one in the layout builder.
I am not sure if there are other exemples with multiple layers of CKE5 editors ?
Regards,
Comment #14
yospyn commentedConfirming #9 worked, I used asset injector to apply CSS to the Claro theme. Not ideal but it did the job.
For me, this was only an issue in paragraphs and in my case layout paragraphs.
Comment #15
kiwimind commentedSimilar to #14. I ended up inserting some CSS via a custom module that seemed to work fine. Quick and simple.
I found that inserting links into e.g. paragraph library items was fine, however inserting them into a rich text paragraph inside layout paragraphs did not display the popup.
Comment #16
bvoynickComment #17
abhisekmazumdarThe patch in this issue: https://www.drupal.org/project/drupal/issues/3328425#comment-14845336
Works for me.
Edit: The patch in https://www.drupal.org/project/drupal/issues/3328425#comment-14845336 works and displays the pop-up, but it does not allow typing in the input box.
Comment #18
jpoesen commentedConfirming #14 and #15: same scenario (ckeditor5 with layout paragraphs); patch in #9 works.
In my case: I subthemed Claro and added the z-index style rule.
Comment #19
attheshow commentedWe ended up using the patch here: https://www.drupal.org/project/drupal/issues/3328425#comment-14845336
Comment #20
mero.s commentedComment 9 helped me, I decided to make a patch for those who will be looking for a quick fix.
Comment #21
mero.s commentedSorry for the previous comment, the patch is not quite correct for the core. This one should work.
Comment #22
wim leersGreat to see so many confirmations that #9 worked!
But … #9 is a comment, not a MR. And #9 is actually the same as #6 in terms of actual changes. This will not get fixed until there's a MR … and I see some names in here that I know could help make this happen! 🤓
This issue needs an MR with a test. #6 contained an imperfect test (see my review in #11) but it's a starting point nonetheless.
Comment #25
immaculatexavier commentedCreated MR for the aforementioned requirement for 11.x
Comment #26
smustgrave commentedThanks for reroll but was previously tagged for issue summary and tests which still appear to be needed.
Comment #28
bkosborneTooltips were appearing beneath the balloons:
...so I added an additional override for them. Also added a comment.
Comment #29
fathima.asmat commentedI can confirm the MR from #26 is working for me. I have rerolled it as a patch for D10.2
Comment #30
nginex commentedReroll for 10.3.x for those who would need a static file
Comment #31
camilo.escobar commentedI have chosen to use the patch from the merge request here: https://www.drupal.org/project/drupal/issues/3328425
Comment #33
klaasvw commentedSetting the z-index too high will make the balloon overlap any dialog that is opened from the balloon (e.g. when using the linkit_media_library module).
Comment #34
saurav-drupal-dev commentedPlease open GIF in new tab to see it clearly.Attempt to Reproduce CKEditor 5 Modal Issue in Drupal 10
Objective
The goal was to reproduce an issue where CKEditor 5 does not work correctly when opened in a modal dialog within a Drupal 9 or Drupal 10 environment. Specifically, we wanted to verify whether the link button in CKEditor 5 would malfunction inside a modal while working fine in a standard form.
Environment
Drupal Version: Drupal 10
Module: CKEditor 5
Testing Module: CKEditor5 Test Module (core testing module)
Step 1: Set Up a Fresh Drupal Installation
Installed Drupal 10 on a local environment.
Configured the standard profile during installation.
Step 2: Enable CKEditor 5 Module
Navigated to the Extend page in Drupal’s admin panel.
Searched for "CKEditor 5" and enabled the module.
Alternatively, we could have used Drush:
drush en ckeditor5 -yStep 3: Modify the settings.php File
Added the following line to the settings.php file to enable scanning for test modules:
$settings['extension_discovery_scan_tests'] = TRUE;Step 4: Enable CKEditor 5 Test Module
i enabled the CKEditor 5 test module to simplify testing.
The module was enabled via the Extend page:
Searched for "CKEditor5 Test" and enabled the module.
Or via Drush:
drush en ckeditor5_test -yStep 5: Modify
CKEditor5DialogTestController.phpWe modified the
CKEditor5DialogTestController.phpto include CKEditor 5 in a form as well as in a modal dialog.The updated code for
CKEditor5DialogTestController.phpis as follows:Step 6: Update the Route for the Controller
We ensured the route YAML file was updated to reflect the correct controller and form.
The route file (
ckeditor5_test.routing.yml) had the following configuration:ckeditor5_test.dialog:
path: '/ckeditor5_test/dialog'
defaults:
_form: '\Drupal\ckeditor5_test\Controller\CKEditor5DialogTestController'
_title: 'CKEditor 5 Dialog Test'
requirements:
_permission: 'access content'
Step 7: Test the CKEditor 5 Functionality
Access the Test Page:
Visited the route
/ckeditor5_test/dialogin the browser to load the form with CKEditor 5 and the modal link.Test CKEditor in the Main Form:
Verified that CKEditor 5 was working properly in the form.
Used the link button in CKEditor and found no issues.
Test CKEditor in the Modal:
Clicked on the "Add Node" link to open a node add form in the modal dialog.
Verified that CKEditor 5 was initialized in the modal as expected.
Tested the link button and other CKEditor functionalities, and found that they all worked correctly.
Step 8: Conclusion
Despite following the steps and conditions that were believed to reproduce the CKEditor 5 issue in modal dialogs, no issues were observed. The CKEditor 5 instance worked properly both in the main form and in the modal dialog, including the link button functionality.
The issue was not reproducible in our Drupal 10 setup.
Comment #35
smustgrave commentedMR appears to have failures and was previously tagged for tests.
Comment #37
vinmayiswamy commentedHi, I updated the
CKEditor5DialogTestto ensure the CKEditor 5 balloon panel is properly positioned above the modal. Kindly please review the changes and let me know your suggestions.Thanks!
Comment #38
anish.a commentedComment #39
aaron.ferris commentedAdded a couple of comments, is the !important necessary with the selectors as they are?
Comment #40
ajmaltash commentedSolution #2 worked for me, thanks @poomkish
Comment #42
vijaycs85Re-rolling against 10.5.x