Problem/Motivation

For media item labels to be positioned correctly, the enclosing <article> needs to be position: relative;. If the page includes the contextual module libraries then the <article> will have the .contextual-region class and be styled by this bit in contextual.module.css

.contextual-region {
    position: relative;
}

There are legit scenarios such as this one with Experience Builder where the media library is used without contextual present -- even on sites with that module enabled.

It winds up looking like this, with the labels under the images out of place (not hugely so, but still not a great look)

Steps to reproduce

  1. Claro should be the admin theme
  2. Add a media library field to any content type.
  3. There should be existing media available so the issue can be seen.
  4. The Contextual module needs to be disabled
  5. Open the media library dialog in the add/edit form for the content type
  6. Note the labels being misaligned for each media item listed, as seen in the screenshot in the prior section.

Proposed resolution

The element that currently gets the position: relative; style from the Contextual module should instead get it from CSS provided by media library so it is always applied, not just when Contextual is enabled

Remaining tasks

Review & Test

User interface changes

Some labels that are out of alignment when Contextual is not enabled (see screenshot in Problem/Motivation) will now look the same as if Contextual was enabled.

When there's an after screenshot for this it should include the markup to show it is aligned without the .contextual-region class present.

Introduced terminology

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

Issue fork drupal-3502895

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

bnjmnm created an issue. See original summary.

quietone’s picture

Version: 11.1.x-dev » 11.x-dev
niranjan_panem’s picture

In Drupal 11 the labels in media library moved to center below the file, below is the screen shot of it.
media library screen shot

bnjmnm’s picture

Re #3 @niranjan_panem in order to reproduce the issue as reported, the contextual module must be disabled.

Since you did not mention disabling the contextual module in your comment, anyone looking at this issue should assume the issue as reported is still valid unless #3 is clarified further.

phenaproxima’s picture

This is of interest to Experience Builder and, therefore, to Drupal CMS. I'm hoping it can be fixed in time for Drupal CMS 2.0, which will have XB as its native page builder.

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

julio_retkwa’s picture

I've added an approach that solves the issue, but my concern is on how to test it widely to make sure it works on all instance
If anyone could help me with that would be great :)

julio_retkwa’s picture

Status: Active » Needs review
bnjmnm’s picture

I've added an approach that solves the issue, but my concern is on how to test it widely to make sure it works on all instance
If anyone could help me with that would be great :)

Testing it widely could be difficult, but there's a way to approach this where this wouldn't be necessary.

Instead of changing padding and max-width, the least disruptive way to do this would be to preserve the styling that is known to already work. If you make the enclosing <article> tag have position: relative;, but use a selector that isn't dependent on the .contextual-region class being present, this fixes it in a way that only requires a few moments of testing.

julio_retkwa’s picture

StatusFileSize
new347.98 KB

Hi @bnjmnm thanks for the insights I've updated my MR based on your suggestion

off topic here:
My previous commits were made based on the following issue:

4 media library items

There is any issue related to that already opened? it basically happens on any media library item that has a text that goes less than 80% of wrapper size

smustgrave’s picture

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

Hello, can the IS be updated please.

Proposed solution
Steps to reproduce
Before/after screenshots in the User Interface section

API and Data model are unchanged so probably can just put NA.

Thanks!

julio_retkwa’s picture

Issue summary: View changes
julio_retkwa’s picture

Hi @smustgrave I've just updated, but I'm not sure if following are right:
* Release notes snippet
* Introduced terminology
* Remaining tasks

May you can assit me with that?

Thank you!

julio_retkwa’s picture

Status: Needs work » Needs review
bnjmnm’s picture

Issue summary: View changes

@julio_retkwa appreciate the attempt but the changes to the summary are not at all what was reported, the steps to reproduce and proposed solution seem like they are from an entirely different issue that happens to be media library related. Among other things you added "Added a js behaviour to scroll up on field media modal open." as the Proposed Solution despite not touching any JS in your MR or the issue having anything to do with scrolling.

I updated the IS to address this.

julio_retkwa’s picture

StatusFileSize
new507.6 KB

#16 Hi @bnjmnm Thanks for jumping into that, I've changed summary wrongly.
Here is the result of my MR:
Screenshot of result

sdhruvi5142’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new350.52 KB
new337.92 KB

Hi
I've applied MR!11488 on Drupal Version 11.x and the changes are working as expected.

Testing Steps:
1. Installed Claro as the admin theme
2. Added a media library field to any content type.
3. Disabled the Contextual module
5. Open the media library dialog in the add/edit form for the content type
6. Observe the changes there

Testing result:
After applying the MR! the Media libarray item styles looks proper nothing seems to be broken. Attaching SS for reference. Moving this to RTBC+1

Status : PASS

  • nod_ committed 3b341184 on 10.4.x
    Issue #3502895 by julio_retkwa, sdhruvi5142, bnjmnm: Media Library item...
nod_’s picture

Version: 11.x-dev » 10.4.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs issue summary update

Committed and pushed 119097957c2 to 11.x and 299c60c7f65 to 10.5.x and 18f2872e543 to 11.1.x and 3b341184245 to 10.4.x. Thanks!

  • nod_ committed 299c60c7 on 10.5.x
    Issue #3502895 by julio_retkwa, sdhruvi5142, bnjmnm: Media Library item...

  • nod_ committed 18f2872e on 11.1.x
    Issue #3502895 by julio_retkwa, sdhruvi5142, bnjmnm: Media Library item...

  • nod_ committed 11909795 on 11.x
    Issue #3502895 by julio_retkwa, sdhruvi5142, bnjmnm: Media Library item...

Status: Fixed » Closed (fixed)

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