Problem/Motivation

With the default_admin theme, going to add a node and trying to insert a media entity, the opened dialog with the media library contains the sidebar toggle that should only be on the main page, but never in dialogs.

Steps to reproduce

Proposed resolution

The issue must be in the hook form alter that injects extra components like that sidebar toggle, and it most likely doesn't handle the ajax request in this scenario, which needs to be fixed.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3590897

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

jurgenhaas created an issue. See original summary.

jurgenhaas’s picture

StatusFileSize
new49.2 KB

I can reproduce this issue with the latest 12.x branch which contains the first merge of the CSS consolidation. Here is what I get:

@mherchel can you please try that at your end again as well please?

mherchel’s picture

Status: Active » Closed (cannot reproduce)

Yeah, my results are identical to you. The issue above is styling. Closing this as cannot reproduce

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.

mherchel’s picture

Status: Closed (cannot reproduce) » Active

Re-opening. I can reproduce it.

jurgenhaas’s picture

OK, here is what happens: it works correctly in the body field, i.e. when the media library opens inside ckeditor. But it doesn't work when this comes from a media reference field.

The difference is: the request from the body field comes with a _wrapper_format=drupal_modal query argument, while the media entity button calls in with _wrapper_format=drupal_ajax.

In \Drupal\default_admin\Hook\FormHooks::isModalOrOffcanvas we determine whether special handling is required or not, and so far, Drupal ajax calls did require that handling. Just dialog and modal calls don't.

This feels like an issue with the media reference call, not the theme. Let me do some more tests before I call that an issue elsewhere.

jurgenhaas’s picture

Assigned: jurgenhaas » Unassigned
Status: Active » Needs review

As sticky action buttons are not supported by the default admin theme for now, we don't need that special case and can treat all ajax requests the same. The attached MR fixes that and should be tested also by verifying that this is not causing any regressions.

bernardm28’s picture

I can confirm this fixes the issue.
image with the issue.

Without this patch the media window on a content type displays the sidenav button which lets you trigger an action behind that window.

The image below is how it looks after this patch.

after this patch.

That's more inline with i will expect that window to look without an extra button.

bernardm28’s picture

Status: Needs review » Reviewed & tested by the community

  • lauriii committed c6b13555 on main
    fix: #3590897 Sidebar toggle is visible and functioning in media library...

  • lauriii committed 6502b3a8 on 11.x
    fix: #3590897 Sidebar toggle is visible and functioning in media library...

  • lauriii committed 05482f51 on 11.4.x
    fix: #3590897 Sidebar toggle is visible and functioning in media library...

lauriii’s picture

Version: main » 11.4.x-dev
Status: Reviewed & tested by the community » Fixed

Thank you for fixing this!

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.