Media library grid item label sticks out, media alignment should adhere to positioning standards

Created on 1 February 2023, almost 2 years ago
Updated 16 September 2024, 3 months ago

Issue summary updated as of comment #14

Problem/Motivation

  1. 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.
  2. 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

  1. Enable Media and Media Library modules.
  2. Goto /admin/content/media-grid
  3. Add media with short filename

Proposed resolution

  1. .media-library-item__attributes should be shrunk to address the media name space bleeding into either ends of the Y axis.
  2. Media element should be aligned to the top of its name space.

BEFORE patch

AFTER patch

๐Ÿ› Bug report
Status

RTBC

Version

11.0 ๐Ÿ”ฅ

Component
Claroย  โ†’

Last updated 2 days ago

Created by

๐Ÿ‡ญ๐Ÿ‡บHungary Zsuffa Dรกvid

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @Zsuffa Dรกvid
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary Zsuffa Dรกvid

    I attached a possible patch to resolve the issue.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia _utsavsharma

    Tried to fix CCf for #2.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    Verified the patch #3 and tested it on Drupal version 10.1.x. The patch works fine and I have added the before and after screenshots for reference.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sonam.chaturvedi Pune

    Verified 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

  • Status changed to RTBC almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    Based 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:

  • ๐Ÿ‡ญ๐Ÿ‡บHungary Zsuffa Dรกvid

    In 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.

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gauravvvv Delhi, India

    Fixed order/properties-order. Attached patch and interdiff for same. please review

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    Verified 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.

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Since this is a UI change screenshots should be added to the issue summary please.

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Issue 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.

  • Assigned to akashdab
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab

    Updated summary as of comment #14.
    Positioning standards adopted from here.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab

    Adding before/after screenshots.

  • Merge request !8547Update media-library.css โ†’ (Open) created by akashdab
  • Pipeline finished with Failed
    6 months ago
    Total: 795s
    #208703
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gauravvvv Delhi, India
  • Pipeline finished with Success
    6 months ago
    Total: 568s
    #209170
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Looking at the screenshots in the summary not sure this is an improvement? First image in the before definitely looks better.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab

    I think the before/after images attached previously did not highlight the issue and the solution, uploading a new set of images for better consideration.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab

    I also think the addition of margin: 0.1rem; in media-library-item__attributes does not make much difference to the solution, rather it misaligns the title towards the top right corner. Video showing how.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    If part of the change isn't needed then that should be reverted. Good catch.

  • Pipeline finished with Canceled
    4 months ago
    Total: 68s
    #267791
  • Pipeline finished with Failed
    4 months ago
    Total: 257s
    #267808
  • Pipeline finished with Canceled
    4 months ago
    Total: 57s
    #267826
  • Pipeline finished with Success
    4 months ago
    Total: 746s
    #267831
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akashdab

    Made the suggested changes

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Left 1 question on MR.

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe this one is actually ready.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Thanks 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.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany ckaotik Berlin

    Both 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 ;)

    1. Long labels that have are only fully shown when hovered still have a missmatched box size. This could be fixed with left: 0; right: 0;. Is this intentional?
    2. There is some kind of overhang for the hover effect. This is annoying when trying to hit something below, like an item in the next row or the submit button in an entity_browser.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    Regarding which MR to review:- As per #23 ๐Ÿ› Media library grid item label sticks out, media alignment should adhere to positioning standards RTBC ,

    ..addition of margin: 0.1rem; in media-library-item__attributes does not make much difference to the solution, rather it misaligns the title towards the top right corner.

    MR!9369 has the correct changes. So I'm hiding the branch of MR!8547 as i'm unable to close that MR.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    nayana_mvr โ†’ changed the visibility of the branch 3338309-media-library-grid to hidden.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    Regarding #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, a max-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.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany ckaotik Berlin

    Thank you @nayana_mvr for the screen recording. Point 1 is indeed fixed by changing max-width: calc(100% - 0.625rem); to max-width: 100%. Though removing that style entirely would break the ellipsis effect.

    Regarding point 2, I just checked again and it only shows in Edge (Chrome-based browser), while Firefox displays fine. I suspect some rounding issues going on there.

Production build 0.71.5 2024