openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Action buttons misalign horizontally across cards in the same row in grid view

Open bhardwajparth51 opened this issue 9 months ago • 11 comments

Problem

In the search results grid view, action buttons ("Preview", "Locate", "Add to List") are horizontally misaligned across cards in the same row. Scanning left to right, buttons appear at different heights because each card grows to fit its cover image cards with taller covers push buttons lower, while cards with short or missing covers have buttons sitting much higher.

Reproducing the bug

Go to: https://openlibrary.org/search?q=harry+potter&mode=everything
Switch to: Grid view
Observe: Cards in the same row have action buttons at wildly different heights depending on cover image dimensions or availability.

Expected behavior

Image All cards in a grid row should be the same height, with action buttons consistently anchored to the bottom of every card — regardless of whether the cover image is tall, short, or missing entirely.

Actual behavior

Image

Buttons float at the bottom of each card's natural content height. Cards with taller covers (or missing covers rendered as placeholders with different heights) cause buttons to appear higher or lower than their neighbors.

Context

  • Browser: Chrome 144
  • OS: Windows 11
  • Affects: Theme: Search / Module: UI consistency

Breakdown

Implementation Details (for maintainers)

Requirements Checklist

  • [ ]

Related files

Stakeholders


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

bhardwajparth51 avatar Feb 21 '26 14:02 bhardwajparth51

I would love to work on this and open a PR if the team is open to it

bhardwajparth51 avatar Feb 21 '26 14:02 bhardwajparth51

I have a possible fix for this. How does this look? It covers up the redundant preview link:

Image

abow avatar Feb 22 '26 03:02 abow

I now see the preview link isn't redundant if the book isn't "preview only".

abow avatar Feb 22 '26 04:02 abow

I don't really like the space between the image and the buttons when there is no preview link in the row.

Image

abow avatar Feb 22 '26 04:02 abow

Thanks for the screenshots — really helpful context.

Since the grid cards in static/css/legacy.less are already using a column flex layout, I think we can address both issues with two small CSS adjustments without changing the structure:

Add margin-top: auto to the action buttons to anchor them to the bottom. Change the cover container from justify-content: flex-end to center for better visual balance on shorter or missing covers.

This should keep buttons aligned consistently across the row, avoid extra gaps, and preserve all existing links. I'll open a PR with this unless you'd prefer a different approach!

bhardwajparth51 avatar Feb 22 '26 16:02 bhardwajparth51

I'm not sure to proceed. I just realized that you reported this issue and also said that you wanted to work on it.

abow avatar Feb 23 '26 14:02 abow

Probably makes sense to wait for a team member to comment.

abow avatar Feb 23 '26 14:02 abow

If anything, we might want:

  1. The variable sized covers in this mode should start at the baseline rather than the top. e.g. height:100% for sri--w-main in grid mode.
  2. Let's hide the "Preview" link (above the buttons)

Moving forward and not for this PR, "Preview Only" will likely become something like "Search Inside" which pulls up the book to ?q= and makes the preview more useful... And books that are borrowable or open will use the dropdown / dropper to also have a "Search Inside" option so every readable book can still be previewed as "Search Inside"; cc @cdrini

mekarpeles avatar Feb 23 '26 20:02 mekarpeles

@bhardwajparth51 I've assigned you on another issue and since @abow seems to have a sense for how to approach this issue, I'd love to give them a shot if that's okay.

mekarpeles avatar Feb 23 '26 20:02 mekarpeles

Side note, as a community opened bug, we will try to review as time permits, please note we've marked it as Priority 4 as we have other issues we're committed to for the month.

mekarpeles avatar Feb 23 '26 20:02 mekarpeles

Fixed by https://github.com/internetarchive/openlibrary/pull/12696

lokesh avatar May 12 '26 19:05 lokesh