Problem/Motivation
CKEditor 5 uses tooltips named balloons to provide the configurable functionalities integrated with the editorial experience. For instance with adding a link, a sort of popup named balloon appear to let you configure the link.
This feature though is added of "canvas" in a div with the class ck-body-wrapper:
That result in the tooltip being missdisplayed (not visible at all) in CKEditor 5 within modals. Hence, the functionality not usable at all. This one, and all relying on those tooltips.
This is true for :
- CKEditor 5 used in textarea configured on views since views uses modals #2741187: Allow usage of WYSIWYG in views text area fields
- for people using Layout Paragraphs to build content
- for any textarea field in a form opened in modal mode
- for any other contrib or core module that would use textareas in modal and that I am not currently aware of
Steps to reproduce
You could apply / try patch here for instance, or use the layout paragraph module.
Proposed resolution
The modal is opened with a given z-index. For example in Seven it is z-index: 1260.
I suggest to apply the following CSS to the .ck-body-wrapper class :
position: fixed;
z-index: 1300;
However, with this trick, the input field still do not get the focus, which I don't know how to handle at the moment.
Comment | File | Size | Author |
---|---|---|---|
#63 | core-3301631-8-9.5x-combined.patch | 7.82 KB | nod_ |
#61 | 3274937-61.patch | 8.37 KB | bnjmnm |
#58 | core-cke-dialog-focus-3274937-58.patch | 8.3 KB | mrinalini9 |
#55 | interdiff-53-55.txt | 334 bytes | nod_ |
#55 | core-cke-dialog-focus-3274937-55.patch | 8.37 KB | nod_ |
Comments
Comment #2
Wim LeersDoes CKEditor 4 work correctly in (modal) dialogs?
Comment #3
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedAs per my setup using Layout Paragraph yes, perfectly fine. I use that setup on multiple website so far D8 and D9.
As per used in views, I also did not noticed any problem so far, but I change my views much rarely so...
It is supposed to not support the media library browser which is a modal itself when opened from CKEditor within a modal :
#2741877: Nested modals don't work: opening a modal from a modal closes the original but so far I never experienced it myself.
Comment #4
Wim LeersThanks for confirming!
Then this is a regression and hence a new stable blocker.
Comment #5
Wim LeersComment #6
nod_Haven't looked at the code but from the description it's probably related to tabbingManager
Comment #7
nod_So what is happening is that the CKEditor tooltip is added outside the modal pane (makes sense to prevent issues with overflow hidden and that kind of things).
But jQuery UI dialog checks for focusable elements within the dialog only, since the new tooltip is not part of the dialog tree the focus is sent back to the ckeditor area.
The relevant code that manage the focus: https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/misc/dialog... (which overrides the original method) and the focus trap is created here: https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/assets/vend...
Here is a patch that makes it work by breaking that whole focus trap feature, added the CSS wherever and the patch from #2741187-35: Allow usage of WYSIWYG in views text area fields to make it easier to test by opening a views UI dialog with a textarea. Tabbable nightwatch tests are passing so it's interesting.
As for the resolution, not quite sure how to handle it yet.
Comment #8
Wim LeersWow, nice investigation! I can’t believe your hunch you had within seconds of me explaining it yesterday was spot-on! 😄👏
Comment #9
nod_It wasn't tabbingmanager though 😂
Comment #10
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedI applied the patch on my website to try it. The same one as used to create the issue description.
Here is a screenshot showing the creation of link in a textarea on the view config page :
Same place, add an image of the previous screenshot (love the inception here!)
And finally the same test as per original GIF which is using CKE5 inside the modal of layout paragraph.
As per this initial test, it seems that from a functional point of view, the patch as #9 solves the issue.
Thanks a lot for making this happen.
Comment #11
Wim LeersThis seems to have consequences?
Needs comments to explain why 🤓
Wow, this … means that this didn't have a text editor at all before?!
That's the hunch/vague memory I had in #2.
Looks like this goes back all the way to Views getting moved into core…
Comment #12
Wim LeersComment #13
nod_Comment #14
woldtwerk CreditAttribution: woldtwerk commented`position: fixed;`
caused the ck5 table tools to be miss aligned. I just changed the `--ck-z-modal` property which works nicely for me.
Comment #15
nod_Looks like this could fix it. not too pretty but functional.
Comment #16
Wim LeersI suspect this should not have been commented out? 🤓😅
Comment #17
nod_indeed :)
Comment #18
nod_trying again
Comment #19
nod_all right, let's not loose faith :D
Comment #20
Wim Leers🤓 Nit: s/ckeditor/CKEditor 5/
🤓 Nit: Inconsistent language: "CKEditor 5 editor" vs "CKEditor 5 Instance"
IMHO we should remove this change.
Because this changes behavior not just for CKEditor 5, but also CKEditor 4.
Comment #21
nod_will get to it tomorrow, at least i didn't break anything else :)
Comment #22
nod_fixed a few suggestions, still needs tests.
Comment #23
Wim Leers#3065095: CKEditor native dialogs not clickable inside of jQuery UI dialogs sounds suspiciously similar but is for CKEditor 4 😅
Comment #24
nod_failing test
Comment #25
Wim LeersQueued test run 😊
Comment #26
Wim LeersNo French jokes here?!? 😜 So much 🍷 or 🥖 opportunity!
🤔 Tool tips? I think you meant inputs?
Seems pretty clear! 👍
Comment #27
nod_I don't know what's going on, when I run the test, the extra library is not loaded so test fails :/ when I enable the page and browse it with umami theme, things work as expected.
1. i'll joke when that thing works :p
2. it's the focus inside tooltips inside dialogs that we're testing, renamed the method :)
3. i wish I could confirm that it works :p
Went with the approach in the related CKE4 issue for initialization of the fix, better than messing with file weights.
Funny thing I noticed is that the offcanvas didn't have focus issues, don't know what's different.
Comment #28
Wim Leersoff-canvas
has a CSS reset:misc/dialog/off-canvas.reset.css: {}
.… and it suspiciously also has this:
🤔🤔🤔🤔
Comment #30
nod_test still broken, still works when loaded outside a test. Do not know why the library alter is not taken into account during the tests.
no interdiff, changed a bunch of stuff, in how i added the js file fix so I'll start making interdiffs when things are working somewhat.
Comment #31
nod_finally found why it didn't work in tests. A case of self own #3267204: library_info_alter can abort early if locale is not enabled.
Here is a failing patch (I'm just returning early in the JS file, that's why both patches have the same size).
For some reasons
$content_area->getText() === $link_url
returns false even if both strings look the same… so just checking it's not empty.Comment #32
nod_Comment #33
Wim LeersOMG!!!!!!!! Can't believe #3267204: library_info_alter can abort early if locale is not enabled struck again!
The failing patch's early return that you so cleverly added is being caught by babel sadly:
… so could you upload a true test-only patch? 🤞 😄
Comment #34
Wim Leerss/Instance/instance/
Übernit: s/Ckeditor/CKEditor/
Übernit: s/CKEditor5/CKEditor 5/
Less über nit: it's not checking styling nor styling in off-canvas. This description needs to be updated 🤓
Comment #35
nod_Failing patch, making a new one with doc fixes.
Comment #36
nod_comments from #34 fixed
Comment #38
Wim LeersComment #39
lauriiiWhy is this in
normalize-fixes.css
? This is supposed to be a very low level CSS that simply addresses regressions caused by normalize.css. I assume that you wanted to load the variable as part of the first CSS files being loaded, but wouldn't there be a way to do that with the libraries system from CKEditor 5 module?I would reword this as:
Instead of describing how this file is loaded, I would include a high level explanation of the file. This could potentially be an additional comment but I'm not sure it's even necessary or preferred since if we change how this file is loaded, it would be unlikely that we would remember to update this. It's also relatively straight forward to search how a file is being loaded.
Are we sure we can remove this in https://www.drupal.org/project/drupal/issues/2158943? We might have to override the modal dialog focus trap of the new implementation too. I would just omit this.
I think this comment leaves some room for confusion. To me this comment implies that we would fallback to the jQuery UI default
_focusTabbable
implementation which isn't the case. What happens here is we essentially disable all jQuery UI focus trapping when inside CKEditor 5 since it implements its own focus trap when necessary.Comment #40
nod_Hopefully it's a bit clearer.
Comment #41
nod_Comment #42
Wim Leers🤔 This location suggests the comment above applies to this too. But I don't think for the CSS the order matters at all? I think that could be documented in a comment too.
s/jquery-ui/jQuery UI/
👏 This is way clearer!
Comment #43
nod_Comment #44
Wim LeersThanks!
Comment #45
lauriiiCommitted 6d6ab58 and pushed to 10.0.x. Thanks!
We still need a 9.5.x patch for this.
Comment #47
nod_9.5.x patch
Comment #49
nod_so we get the deprecation because we load a node edit form in the dialog for the test. This node edit form has a date field that loads modernizr. Not sure how the rest of the tests pass since that date library is also deprecated 🤔
Comment #50
nod_it's the collapse script that relies on core/modernizr and the deprecation notices is triggered by the fact that the replacement script is not used on the collapse library. Adding it to the library fixes the deprecation notice
Comment #51
Wim LeersThis is the only change compared to #43 👍
Comment #52
lauriiiLooking at #3101922: Find replacement for Modernizr touchevent test and deprecate now from the angle of this issue, I'm wondering if we should remove the deprecation warning from the
Modernizr.addTest
since it doesn't make sense to trigger that for all uses of Modernizr, including those that don't require touchevents. For example, here we are adding dependency to the touchevents in a place where that isn't stricly required. Maybe we could open a follow-up and add a todo to removecore/drupal.touchevents-test
as a dependency ofcore/drupal.collapse
once we no longer trigger deprecations there?Comment #53
nod_I'd rather not have the dependency at all to fix the extra deprecation message. we can add the library in the test to work around that without changing the core library definition, that seem to work :) added a todo linked to #3269082: Remove HTML5 details collapse polyfill in the test controller.
Comment #54
Wim LeersDrupalCI failed.
Comment #55
nod_I dislike the compile step :p
Comment #56
Wim LeersComment #57
SpokjePatch doesn't apply any more since 17 Jun 2022 at 18:02 CEST.
Comment #58
mrinalini9 CreditAttribution: mrinalini9 at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch #55, please review it.
Comment #59
SpokjeUnhappy TestBot
Comment #60
SpokjeComment #61
bnjmnmComment #62
xjmCKEditor 5 v35.0.1 breaks the test (and maybe the functionality) added in this issue. The committed test is being marked skipped on 10.1.x and 10.0.x for that reason. I filed #3301631: Regression with CKEditor 35.0.1 and modal dialogs to address that.
Comment #63
nod_Patch from #61 + patch from #3301631-8: Regression with CKEditor 35.0.1 and modal dialogs to fix the regression
Comment #66
lauriiiCommitted 8969faf and pushed to 9.5.x and cherry-picked to 9.4.x. because CKEditor 5 is experimental. Thanks!
Comment #68
NicholasSMaybe this is a problem with https://www.drupal.org/project/layout_paragraphs but this is still broken for me on Core 9.5.0-RC2
core-9.5-rc2--layout-paragraphs.mp4
After learning about
~
when using layout paragraphs my dom elements are not in the right order, so the css fixe does not apply. My .ck-body-wrapper comes before ui-dialog and the CSS requires it in that exact order https://www.w3schools.com/cssref/tryit.php?filename=trycss3_gen_siblingComment #69
NicholasSNot sure why the
~
selector is required, but for me this works too.Comment #70
bamlhes CreditAttribution: bamlhes at SharedTech for SharedTech commentedThank you @NicholasS your comment#69 works well with the properties table tooltip with modal Bootstrap 4
Comment #71
J. CreditAttribution: J. commented#69 Solved table tooltip issue for me too!
Comment #72
Nchase CreditAttribution: Nchase as a volunteer commentedpatch from #63 does nothing in 9.5 when the text field is within a layout_paragraphs.
Comment #73
rraney CreditAttribution: rraney commentedI'm having this same problem using Layout Paragraphs. The text editor dialog box has a higher z-index than the CKEditor 5 balloon when I click on the "link" chain icon. The CSS suggestion in #69 works when applied to my Admin theme. I am weary of applying the patch since it has so many code changes. Is the patch the recommended way to go? Anyone know if the CK5 team is working on this for a future release?
Comment #74
bnjmnmIt looks like several people are still having problems! I recommend creating a new issue documenting this and include steps to reproduce. It's incredibly rare that additional changes occur in an already closed issues, and on the occasions it happens it is within a few days of the issue being closed. If anyone's interested in seeing the issue addressed, a new issue should be created, it won't be on anyone's radar otherwise.
Comment #75
berliner CreditAttribution: berliner commentedI see this problem in Layout Paragraphs when the Gin admin theme in version 8.x-3.0-rc1 is used. It sets the
--ck-z-modal
to 98 for allck
classes. Updating to 8.x-3.0-rc2 fixes the issue.Comment #76
luenemannPer #75 this was fixed by #3331304: ckeditor5 balloon area not shown in modal for gin.
Comment #77
Nchase CreditAttribution: Nchase as a volunteer commentedThe patch at https://www.drupal.org/project/drupal/issues/3328425 works.
Comment #78
Lissy CreditAttribution: Lissy commentedThanks to @NicholasS,
patch in #69 works for me with Layout Paragraph.