Skip to content

Original aspect ratio of image in DataViews #81567

Closed

Description

@fcoveram

Now that #79329 has been merged and DataViews is powering the media in the modal within Gutenberg’s experiments, I think we need to talk again about displaying the original aspect ratio of images in DataView’s image field.

With the introduction of DataViews in media, displaying entries at their original aspect ratio is key to a good UX. Identifying the image ratio is crucial to prevent unexpected outcomes when inserted into the canvas.

#63487 introduced different ideas, and I think this one by @richtabor is a great first step.

Image

One value of layouts worth highlighting is that each layout establishes a different visual hierarchy, and depending on the type of data, it works better in certain cases than others. For instance, the original aspect ratio of images works better in a grid when selecting images intended to be used as such. But it might not work as well in a table if some images are tall and others are wide.

Layouts prioritize certain content through their design, and default views for each screen suggest which layout could work better for the type of content it displays.

What is your proposed solution?

As per the solution, I would add a ToggleControl in the View options between Density and Preview size that comes on by default in the Media in modal

[On/Off] Original aspect ratio 

What do you think of this @andrewserong, @richtabor, @WordPress/gutenberg-design, and @WordPress/gutenberg-components?

Activity

  1. added
    [Feature] MediaAnything that impacts the experience of managing media
    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond
    on Aug 14, 2026
  2. andrewserong commented on Aug 14, 2026

    @andrewserong
    Contributor

    Thanks @fcoveram I feel like you read my mind! Yes, I'd love for us to try out a toggle to switch between contain/cover for the display of images, and to default to preserving the aspect ratio. From memory @annezazu also flagged this for when we look at the media inserter, so just also linking to the following, as whatever we do for this feature we should likely do the same when we redesign the media inserter:

    One question re: how it'd look on the overall canvas/body area of the dataviews:

    Would we still have a square for the grid item (and the border being at the edge of the square) with the image contained in its aspect ratio? I.e. something like:

    Image

    Or were you imagining something more like a masonry-like layout? One issue with the patterns screenshot above is that the items don't line up visually which can be a bit hard when scrolling through a large list of items, so I'm wondering if retaining the square area is important here 🤔

  3. andrewserong commented on Aug 14, 2026

    @andrewserong
    Contributor

    I've tried out a draft for this over in:

    It's just a draft for now so we can see how it looks and feels. Here's that PR's current state:

    Image

    Already I'm noticing that the checkboxes can be a bit hidden and the overall grid item can look a bit stark, so maybe they need a background color? Happy to keep hacking on this next week if we think it's worth pursuing further!

  4. andrewserong commented on Aug 14, 2026

    @andrewserong
    Contributor

    @tellthemachines raised a good question while we were chatting about this just now. Do we know that users would like to toggle this? One option could be to keep this flag as an internal layout flag that the consumer can declare for the individual DataViews instance, if we don't want to clutter up the Appearance popover. So the default would still be cover for consumers, but for example, for the media picker we could set it to contain.

    In any case, #81604 tries it out with a toggle — we can always pare that back if it feels too much!

  5. fcoveram commented on Aug 14, 2026

    @fcoveram
    ContributorAuthor

    Thanks @andrewserong. I just added a comment in #81604.

    Do we know that users would like to toggle this?

    I'm opinionated about this, and I would say it should be enabled by default in media-related views.

    Since the interaction that occurs after selecting one or more images displays the images at their original ratio, knowing this in advance of the user journey is key.

  6. tellthemachines commented on Aug 17, 2026

    @tellthemachines
    Contributor

    If we leave the toggle out for now, we can always add it in later if we determine it's wanted. Otherwise, if users don't really want it, it becomes clutter.

    knowing this in advance of the user journey is key

    Also, if someone accidentally toggles the original aspect ratio off, they'll end up having a worse experience and might now know how to switch it back.

  7. jasmussen commented on Aug 17, 2026

    @jasmussen
    Contributor

    Worth probably adding a light grey background to the bordered cell, so each item still feels like a unit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Feature] MediaAnything that impacts the experience of managing media[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions