Problem/Motivation

The feature that allows users to preview media using a modal (a type of pop-up window) is not showing correctly. This could mean that when attempting to preview media files such as images, videos, and audio the expected preview within the modal window is not displaying properly. The vertical tabs look broken in the media library dialog. I have attached a screenshot for better reference.

Steps to reproduce

  1. Install Drupal with standard profile
  2. Enable media and media library modules
  3. Add a media field to Article content type
  4. Set widget for media field on Article form to Media Library
  5. Create new Article
  6. Click Add media
  7. You will see the vertical tabs are broken in the media library modal

Proposed resolution

Restore vertical tabs CSS custom properties to core/themes/claro/css/base/variables.pcss.css from core/themes/claro/css/components/vertical-tabs.pcss.css. See #35

Remaining tasks

Needs review

User interface changes

Before

before

After

after

API changes

Data model changes

Release notes snippet

Issue fork drupal-3404866

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

Nitin shrivastava created an issue. See original summary.

nitin shrivastava’s picture

Issue summary: View changes
StatusFileSize
new7 KB

nitin shrivastava’s picture

StatusFileSize
new33.99 KB

Example

nitin shrivastava’s picture

Status: Needs work » Needs review
shweta__sharma’s picture

StatusFileSize
new344.9 KB
new230.65 KB
new345.56 KB

Hi @ Nitin shrivastava, I have checked this issue on my end the issue is replicated in my local. Also applied MR 5583 and it is perfectly applied and working fine. The media modal is themed now but according to me, this issue should be fixed in the Claro theme as Claro is a default admin theme.

The issue also exists in the claro theme as well.

Below are some screenshots:-

Oliver before the patch -

before-patch

Olivero after the patch -

after-patch

Claro admin theme -

claro

shweta__sharma’s picture

Issue summary: View changes
nitin shrivastava’s picture

Status: Needs review » Reviewed & tested by the community
cilefen’s picture

Status: Reviewed & tested by the community » Needs work

The merge request failed its pipeline.

nitin shrivastava’s picture

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

Status: Needs review » Needs work
StatusFileSize
new1.48 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch 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.

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

gauravvvv’s picture

Status: Needs work » Needs review
smustgrave’s picture

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

Closed #3406681: Drupal Modal media library menu items should be designed in a better way as a duplicate.

If this is failing both themes a solution should be made to make the styling generic

Also issue summary isn't following standard template when it should

gauravvvv’s picture

Status: Needs work » Needs review

There were some variables missing in core/themes/claro/css/theme/media-library.pcss.css file. I have added them in the MR.

shweta__sharma’s picture

StatusFileSize
new223.67 KB

The MR fixed the issue for Claro theme.

image

smustgrave’s picture

Status: Needs review » Needs work

So my comment was to see if a generic solution could be found, is this just fixing claro? What about olivero?

Should be documented in issue summary.

gauravvvv’s picture

StatusFileSize
new267.42 KB

For Olivero, this could be a feature request rather than a bug. The Media Library dialog was never themed in Olivero. Also, could someone provide the steps to reproduce this issue without using any contrib module?

Here, I have attached a screenshot from an earlier version (10.x), and it is broken on that version as well.

Note: I am using Olivero as the admin theme to reproduce the bug. However, we do not support using Olivero as the admin theme.

andy-blum’s picture

Component: Olivero theme » Claro theme

The MR changes code only in Claro, so updating this to the Claro issue queue.

shweta__sharma’s picture

Status: Needs work » Needs review

Agree with #18 comment as we do not support the Olivero theme as an admin theme. Updating status to NR
Thanks

smustgrave’s picture

Title: Drupal media Modal preview broken. » Drupal media Modal preview broken in Claro
Status: Needs review » Needs work

IS still needs updating.

shweta__sharma’s picture

Issue summary: View changes

Issue summary updated also added standard template.
Thanks

shweta__sharma’s picture

Status: Needs work » Needs review
Issue tags: -Needs issue summary update
sandeep_k’s picture

StatusFileSize
new109.38 KB
new156.46 KB
new154.13 KB

Verified and tested patch MR !5583 mergeable on Drupal version-
11.0-dev. The patch was applied successfully and looks good to me.

Testing Steps:

  1. Set up the Drupal 11 site.
  2. I enabled the Claro theme for admin.
  3. Enable the media module and Add a media field.
  4. Click on add content type and insert media.
  5. Apply the shared patch & reverify the results.

Testing Results:
Now the media Modal broken preview issue is fixed for the Claro theme, Although the issue is still there for the Olivero theme. We can move this to RTBC as this ticket is for the Claro theme.

saschaeggi’s picture

saschaeggi’s picture

Status: Needs review » Needs work

Instead of introducing duplicates of the CSS variable defined in vertical-tabs.css we should aim to actually include the correct library (vertical tabs).

Moving this back to needs work.

omkar-pd made their first commit to this issue’s fork.

omkar-pd’s picture

Status: Needs work » Needs review

@saschaeggi, I've included the vertical-tabs library in media-form. Please review.

saschaeggi’s picture

Status: Needs review » Needs work

@omkar-pd thank you for working on this. I've left one suggestion to prevent loading the library generally. Otherwise this approach looks good to me 👍

prashant.c’s picture

Status: Needs work » Needs review

@saschaeggi @omkar-pd

This library $form['#attached']['library'][] = 'claro/vertical-tabs'; will only get added on the Media Library Form as it is already inside the

hook_form_BASE_FORM_ID_alter()
claro_form_media_library_add_form_alter(array &$form, FormStateInterface $form_state)

Therefore, in my opinion we do not need any additional check here.

Thanks

saschaeggi’s picture

Status: Needs review » Needs work

@Prashant.c

Therefore, in my opinion we do not need any additional check here.

We do as per default we don't have tabs in this dialog.

prashant.c’s picture

Yes, that's correct. Including the library fixes the issue but these are not vertical tabs.

prashant.c’s picture

We need help from some front-end dev here as adding the vertical-tabs library fixing the issue but the links/tabs within the media modal window are not vertical-tabs so IMO it is not a good idea to add this library here.

Thanks

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

godotislate’s picture

Doing some archaeology:

In #3023767: Reuse or build on vertical tabs styling in media library, there was some thought of consolidating the media library menu and vertical tabs, whether through a shared CSS file, or refactoring the media library to actually use vertical tabs, but the conclusion was just to address media library menu CSS directly in the admin theme (then Seven).

In #3062751: Media and media library, the media library was re-designed in Claro. The vertical tabs CSS custom properties were from core/themes/claro/css/components/vertical-tabs.pcss.css to core/themes/claro/css/base/variables.pcss.css in this commit on 9.2.x.

In #3332729: Refactor Claro's vertical-tabs stylesheet, in the effort to refactor the vertical tabs CSS and putting component custom properties in the corresponding component CSS file, the vertical tabs custom properties were moved back from core/themes/claro/css/base/variables.pcss.css to core/themes/claro/css/components/vertical-tabs.pcss.css, without awareness that media library also depended on them.

I think it's best to move these variables back to core/themes/claro/css/base/variables.pcss.css and document why they need to live there. Pushed commit with this to the MR and rebased.

Screenshot before:
Media library dialog before fix
Screenshot after:
Media library dialog after fix

godotislate’s picture

Issue summary: View changes
saman malik’s picture

Assigned: Unassigned » saman malik
StatusFileSize
new86.83 KB
new84.93 KB

Verified and tested patch MR !5583 mergeable on Drupal version-
11.0-dev.
The patch was applied successfully and looks good to me.
Testing Steps:

  1. Set up the Drupal 11 site.
  2. I enabled the Claro theme for admin.
  3. Enable the media module and media library and Add a media field.
  4. Click on add content type and insert media.
  5. Apply the shared patch & reverify the results.

Testing Results:
Warning/errors were not found after applying the patch and it is as per the coding standard.
Can be move to RTBC

saman malik’s picture

Assigned: saman malik » Unassigned
shweta__sharma’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new245.14 KB

Verified and tested MR !5583 on Drupal 11 and it is working fine. Media library tabs/links now look good. Moved Claro vertical-tabs CSS custom properties back to base variables.css

Attached after screenshot -

after-patch

Moving to RTBC

Thanks

kanchan bhogade’s picture

StatusFileSize
new91.83 KB
new90.52 KB

Hi, I tested MR !5583 on Drupal version 11.0
The patch was applied successfully
Testing Steps:

  1. Set up the Drupal 11 site.
  2. Set the Claro theme as a default theme
  3. Enable the media and media library modules
  4. Add a media field for the content type
  5. Click on add content type and insert media.
  6. Apply the shared patch & reverify the results.

The patch was applied successfully, and the media Modal broken preview issue is fixed for the Claro theme.
Can move to RTBC

yahyaalhamad’s picture

Patch for 10.2.x for a temporary fix until the new version.

rajab natshah’s picture

Facing the same issue.
Thank you for the MR and the local patch

godotislate’s picture

Title: Drupal media Modal preview broken in Claro » Media Type links in Media Library modal lost vertical tabs styling in Claro
Issue tags: +media library
godotislate’s picture

Title: Media Type links in Media Library modal lost vertical tabs styling in Claro » Media Type links in Media Library modal missing vertical tabs styling in Claro
artemboiko’s picture

Tested MR #5583 on Drupal 10.2.1 looks fine, thanx

graber’s picture

Before this lands as is, worth checking solution in https://www.drupal.org/project/drupal/issues/3416545 as well.

godotislate’s picture

@Graber - the media type links look like vertical tabs, but aren't actually vertical tabs. Adding the core/drupal.vertical-tab library fixes the CSS but adds unnecessary JS. See history of how the CSS got lost: #35

graber’s picture

Ahh, makes sense. We should add this css conditionally and not globally in any case to optimize. Additional library with css only maybe?

godotislate’s picture

graber’s picture

Status: Reviewed & tested by the community » Needs work

I'm quite sure a subsystem maintainer will request the same - no point loading those variables on every page, those are component variables, be it vertical tabs or media library media type links. Those variables should be included conditionally, only if one or both components are present in the current context.

godotislate’s picture