Problem/Motivation

This regression is a result of #3296098: Removal :tabbable usage in dialog.js

Styling and javascript that relies on a CSS selector is broken on the Media Library CKEditor widget. This is because the class media-library-widget-modal is missing on the dialog container element.

While this change was also applied to Drupal 10.3.x it seems to only effect Drupal 11. I'm guessing whatever consumes that config file changed in a way that broke it.

The code change: https://git.drupalcode.org/project/drupal/-/commit/94bfd9fa39f244877b320...

If I revert this changed line in ckeditor5.ckeditor5.yml back to the following then the class is injected properly again.
dialogClass: media-library-widget-modal

Steps to reproduce

Drupal 11, go to a CKEditor input with the Embed Media plugin enabled. Click the Add Media button.
- Expected: the modal should take most of the viewport size
- Actual: the modal is reduced in size, unusable

Proposed resolution

#3296098: Removal :tabbable usage in dialog.js was committed to 10.3.x and 11.x but their commit differs, mainly in OpenDialogCommand::__construct where the issue lies in 11.x, because if $dialog_options['dialogClass'] is set (it is via ckeditor5.js), then $dialog_options['classes']['ui-dialog'] is not taken into account.
Fix it so both are taken into account/preserved + update ckeditor5.js to use ui-dialog since dialogClass is now deprecated.

Remaining tasks

Commit fix to 11.x and 10.3.x ?

User interface changes

Fixes media modal size.

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

None

Issue fork drupal-3474018

Command icon 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

rhovland created an issue. See original summary.

sourav_paul’s picture

StatusFileSize
new443.88 KB

I've tested it on D11.0.1 using the mentioned steps.
verified that the class "media-library-widget-modal" is attached.

Sharing SS for reference:

img

rhovland’s picture

Hmm I wonder what is different then? I ran into this with a fresh install of Drupal 11 using the recommended composer template. I installed the umami profile. I also switched to Olivero in case there was something theme specific going on there.

On my actual production site which is on Drupal 10.3.x, PHP 8.1 where the code change had already taken place I don't experience this bug. I assumed that the problem surfaces on 11 due to removal of things but maybe not?

Did you test this on a new install or an existing site?

sourav_paul’s picture

I tested it on new D11 instance.

sourav_paul’s picture

@rhovland have you retested the issue?

rhovland’s picture

I just tested it again with a new install from the composer recommended template. This time using the standard profile. Enabled the media module, added the embed media button to the basic text format.

Created a new basic page. Clicked the add media button. Class media-library-widget-modal is missing.

Checked both Chromium and Firefox.

Server:
Linux drupal11-test 5.15.0-125-generic #135~20.04.1-Ubuntu SMP Mon Oct 7 13:56:22 UTC 2024 x86_64
Nginx with PHP-FPM
PHP Version 8.3.11

keiserjb’s picture

I had found another issue talking about this. I had noticed on my Drupal 11 site that the media library modal was narrower than in Drupal 10. I then found the missing class.

https://www.drupal.org/project/drupal/issues/3473586

keiserjb’s picture

Changing the line in ckeditor5.ckeditor5.yml certainly fixes the problem.

rhovland’s picture

Looks like this affects other users as well but only some of them.

mckinzie25 made their first commit to this issue’s fork.

mckinzie25’s picture

StatusFileSize
new564 bytes

This is a patch applying the change suggested in the original ticket. It restores the line

dialogClass: media-library-widget-modal

to ckeditor5.ckeditor5.yml.

rmpereira’s picture

Thanks for the patch, it works for me on Drupal 11.1.1.

skymen’s picture

Also works for me on Drupal 11.1.1. Thanks!

kushagra.goyal’s picture

Issue summary: View changes
Status: Active » Needs review

Yes, MR changes are working correctly. Moving to review..

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Will need test coverage as a bug.

dhirendra.mishra’s picture

Patch is working for me as well. but not sure why class - ui-dialog-narrow is added here when used in ckeditor
while using media field out of ckeditor does not have this class ? do we also want to remove this class ? if no then may i know what is the use of this ?

catch’s picture

Status: Needs work » Needs review
Issue tags: +Needs manual testing

We don't have visual regression testing in core so I'm not sure how we'd add test coverage for this, tagging for manual testing though.

smustgrave’s picture

We can't add a test to verify the existence of a class?

smustgrave’s picture

Status: Needs review » Needs work

Seems to be consistently having a test failure though.

herved’s picture

I can confirm the issue as I stumbled on this after upgrading to D11.
It's very easy to reproduce with demo_umami profile and opening the add media modal from ckeditor.
I just did a git bisect on the 11.x branch and
66c3914d39bf24d828ec8516389d7cadad52294e is the first bad commit and indeed comes from #3296098: Removal :tabbable usage in dialog.js

herved changed the visibility of the branch 3474018-alt to hidden.

herved changed the visibility of the branch 3474018-alt to active.

nicxvan’s picture

Title: [regression] Class is not added to MediaLibrary dialog » [regression] CSS class is not added to MediaLibrary dialog
herved’s picture

Status: Needs work » Needs review

Created new MR, the actual fix is in OpenDialogCommand::__construct
- #3296098: Removal :tabbable usage in dialog.js was committed to 10.3.x and 11.x but their commit differs, mainly in OpenDialogCommand::__construct where the issue lies in 11.x, because if $dialog_options['dialogClass'] is set (it is via ckeditor5.js), then $dialog_options['classes']['ui-dialog'] is not taken into account.
- this MR contains improvements in order to ensure both $dialog_options['classes']['ui-dialog'] and $dialog_options['dialogClass'] are taken into account/preserved.
- 10.3.x is not affected by this bug per-se because it does preserve $dialog_options['classes']['ui-dialog'], however it could (should IMO) be ported as well, for consistency.
- I took the opportunity to align the way this is handled in OpenDialogCommand and OpenOffCanvasDialogCommand
- Added some regression tests for those + test to ensure the media-library-widget-modal class is present on the ckeditor media library modal.

herved’s picture

StatusFileSize
new9.25 KB

Current MR snapshot, for composer.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

IS appears to need some love

laura.gates’s picture

Thanks @herved for grabbing the latest MR snapshot. Confirmed that this applies correctly in Core 11.1.8

rondog469’s picture

Noting that this fixed and applied cleanly to 11.2.3. Thank you very much

herved’s picture

Issue summary: View changes
Status: Needs work » Needs review
herved’s picture

Issue summary: View changes
herved’s picture

herved changed the visibility of the branch 3474018-regression-class-is to hidden.

herved’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests, -Needs issue summary update +Needs Review Queue Initiative

Left some small comments

Cleaning up tags

Test-only feature was ran here https://git.drupalcode.org/issue/drupal-3474018/-/jobs/5763875 so removing that tag.
Summary is updated so removing that tag as well.

herved’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

herved’s picture

Status: Needs work » Needs review

MR rebased

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing
StatusFileSize
new108.79 KB
new131.93 KB

Before

before

Without the MR this is what I see

After applying

after

So removing the Needs manual tag.

Most of the feedback appears to be addressed, left 1 thread open. But the issue appears to be fixed.

andre.bonon made their first commit to this issue’s fork.

andre.bonon’s picture

StatusFileSize
new9.24 KB

Attaching a patch that works with 11.2.5

joegraduate’s picture

StatusFileSize
new9.07 KB

Attaching current MR !12597 diff as static patch usable with 11.3.x.

mullzk’s picture

Hi everyone.
This issue is RTBC since two months. Four Drupal-Versions 11.2.5-11.2.8 has since been released, without the MR being merged. Our customers still see the same small modal as smustgrave described in #40

May I ask what keeps this Issue from being resolved, and wether there is anything I can help?

siramsay’s picture

I've used the patch from #42 on 11.2.7/8 and it works.

@mullzk if you can, use one of the patches with composer install, reach out if you need help.

nod_ made their first commit to this issue’s fork.

  • nod_ committed 935757de on 11.3.x
    fix: #3474018 [regression] CSS class is not added to MediaLibrary dialog...

  • nod_ committed 462ac972 on 11.x
    fix: #3474018 [regression] CSS class is not added to MediaLibrary dialog...
nod_’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 462ac97 and pushed to 11.x. Thanks!
Committed 935757d and pushed to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

karolus’s picture

Just upgraded one project to 11.2.9 last week from 10.3.x, and am seeing this. Was there some type of regression, or will this be resolved in 11.3.0?

nicxvan’s picture

See comment 48, this was fixed in 11.3