Issue summary updated as of comment #14
Problem/Motivation
- In Claros's media-grid the item's name sticks out of its expected place if the name of the media is shorter than width of the individual grid block. It exceeds both on the top and the bottom of the name space.
- Also, the uploaded media does not adhere to the standardised design, and floats above the media name space instead of being stuck to it.
Steps to reproduce
- Enable Media and Media Library modules.
- Goto /admin/content/media-grid
- Add media with short filename
Proposed resolution
- .media-library-item__attributes should be shrunk to address the media name space bleeding into either ends of the Y axis.
- Media element should be aligned to the top of its name space.
BEFORE patch

AFTER patch

| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 3338309-30-test.gif | 2.63 MB | nayana_mvr |
| #30 | 3338309-30-overhang.png | 4.81 KB | ckaotik |
| #30 | 3338309-30-hover-box.png | 10.24 KB | ckaotik |
| #22 | AFTER-2.png | 129.33 KB | akashdab |
| #22 | BEFORE-2.png | 129.84 KB | akashdab |
Issue fork drupal-3338309
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:
- 11.x
changes, plain diff MR !9369
- 3338309-media-library-grid
changes, plain diff MR !8547
Comments
Comment #2
Zsuffa Dávid commentedI attached a possible patch to resolve the issue.
Comment #3
_utsavsharma commentedTried to fix CCf for #2.
Comment #4
nayana_mvr commentedVerified the patch #3 and tested it on Drupal version 10.1.x. The issue is fixed after applying the patch and I have added the before and after screenshots for reference.
Comment #5
sonam.chaturvedi commentedVerified and tested patch #3 on 10.1.x-dev. Patch applied successfully.
Test Steps:
1. Goto /admin/content/media-grid
2. Add media with short filename
3. Verify media-grid the item's name is higher than the space under the item preview
4. Apply patch #3
5. Verify media-grid the item's name is within the space
Test Result: media-grid the item's name is within the space under the item preview
Screenshot is same as #4
RTBC +1
Comment #6
Zsuffa Dávid commentedComment #7
lauriiiBased on https://www.figma.com/file/VNkUIvfbcGr9Jmez3iRXJBjb/Media-widget-field?n..., it looks like there shouldn't be spacing between the name and the image preview. After this change, there would be some spacing:
Edit: The screenshot is before the patch is applied. However, the solution is to make the name less high, which essentially keeps the image in place and creates that spacing.
Comment #8
Zsuffa Dávid commentedIn the figma design the media items don't contain any images.



But based on your screenshot I made a new patch addressing the space issue.
Comment #9
Zsuffa Dávid commentedComment #10
gauravvvv commentedFixed
order/properties-order. Attached patch and interdiff for same. please reviewComment #11
nayana_mvr commentedVerified the patch #10 and tested it on Drupal version 10.1.x. Patch applied cleanly but for image with small height, there is still space between the name and the image preview. I have added the before and after screenshots for reference.
Comment #12
smustgrave commentedSince this is a UI change screenshots should be added to the issue summary please.
Comment #13
Zsuffa Dávid commentedComment #14
smustgrave commentedIssue summary proposed solution is to shrink item__attributes but I see we are editing the image. Proposed solution needs to match the patch solution.
Also seems to have caused a regression when you select an item in the media library widget a weird grey line appears on the side.
Comment #16
akashdab commentedUpdated summary as of comment #14.
Positioning standards adopted from here.
Comment #17
akashdab commentedAdding before/after screenshots.
Comment #19
gauravvvv commentedComment #20
akashdab commentedComment #21
smustgrave commentedLooking at the screenshots in the summary not sure this is an improvement? First image in the before definitely looks better.
Comment #22
akashdab commentedI think the before/after images attached previously did not highlight the issue and the solution, uploading a new set of images for better consideration.
Comment #23
akashdab commentedI also think the addition of
margin: 0.1rem;inmedia-library-item__attributesdoes not make much difference to the solution, rather it misaligns the title towards the top right corner. Video showing how.Comment #24
smustgrave commentedIf part of the change isn't needed then that should be reverted. Good catch.
Comment #26
akashdab commentedMade the suggested changes
Comment #27
smustgrave commentedLeft 1 question on MR.
Comment #28
smustgrave commentedBelieve this one is actually ready.
Comment #29
quietone commentedThanks for having the latest images available in the Issue summary.
Sorry, folks but there are two MRs here and there is no indication in the issue summary for which one to review. Not sure why there are two MR here.
@smustgrave, you say you left a comment in the MR but I can't find it in either one.
Comment #30
ckaotikBoth merge requests are nearly identical, with MR !8547 including "margin" CSS rules in addition to the "padding" changed by MR !9369.
I've tried the patch in a setup using entity_browser, and have observed two problems still. Maybe this is due to entity_browser, but just wanted to make sure. If so, ignore what I said ;)
left: 0; right: 0;. Is this intentional?Comment #31
nayana_mvr commentedRegarding which MR to review:- As per #23,
MR!9369 has the correct changes. So I'm hiding the branch of MR!8547 as i'm unable to close that MR.
Comment #33
nayana_mvr commentedRegarding #30, I'm able to reproduce the point 1 (Please see the screen recording. This is after applying the current MR changes).
I think it is because of max-width calculation. For
.media-library-item__attributes, amax-width: calc(100% - 10px);is used but I'm not sure why it’s added. Removing that or setting that to 100% fixes this issue. I can implement this change if someone can confirm about this solution.As for point 2 in #30, I'm unable to reproduce that issue. Can be verified in the screen recording attached.
Comment #34
ckaotikThank you @nayana_mvr for the screen recording. Point 1 is indeed fixed by changing
max-width: calc(100% - 0.625rem);tomax-width: 100%. Though removing that style entirely would break the ellipsis effect.I also checked again and I have a minor misalignment that only shows in Edge (Chrome-based browser), while Firefox displays fine. I suspect some rounding issues going on there.
Comment #36
quietone commentedThe Claro theme was approved for removal in #3576460: [policy, no patch] Deprecate and remove Claro.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3576668: [meta] Tasks to deprecate Claro and the removal work in #3584638: [meta] Tasks to remove the Claro theme.