gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Gallery Block: Think up responsive feature

Open jasmussen opened this issue 9 years ago • 8 comments

The gallery block has a slider to pick the amount of columns you see. This is a "one size fits all" slider, that defines the amount of columns across all screen sizes.

How can we make this more responsive friendly, so for example on mobile screens you have a single column, and on big monitors you have big 4 or 5?

One idea is to have two sliders:

  • Max. columns (for big viewports)
  • Min. columns (for small viewports)

Then we'd figure out the responsive math to decide how many to show at multiple breakpoints in between.

A simpler option, perhaps, would be to have a slider for each breakpoint:

  • Columns on desktop
  • Columns on tablet
  • Columns on mobile

Then we'd have exactly three breakpoints.

Thoughts?

jasmussen avatar Jun 26 '17 08:06 jasmussen

I'd honestly leave this up to the theme to decide (via CSS).

Reason being with CSS it's global, whereas it would be a pain setting each breakpoint column for each post/page you make.

paulwilde avatar Jun 26 '17 08:06 paulwilde

I'd honestly leave this up to the theme to decide (via CSS).

I could give that a 👍

jasmussen avatar Jun 26 '17 08:06 jasmussen

I am torn about leaving it up to the theme. I think some intelligent responsiveness out of the box would be better, over leaving it all up to the theme. I also am feeling having extra sliders to set this isn't a great experience - seems contusing.

Can we have a default behaviour for responsive and let the theme take from there?

karmatosed avatar Jun 26 '17 09:06 karmatosed

Thinking outside the box, a different suggestion.

What if instead of "columns" we specify the size of the thumbnail? This would work really well with an implementation using flex and would be a single setting across any screen size. The UI could have a setting for min and max width for the column, maybe even a single value and we calculate some variance in the background (well, we let flex do it).

Pros:

  1. Implementation is a straight build on flex.
  2. No lies: the number of columns is dependent on screen size, and we acknowledge it.
  3. No dependency on the theme column width.

Cons:

  1. Columns are an incredibly intuitive concept to grasp, if one is building only for desktop, that's all they need.

This might be a challenging suggestion exactly due to how intuitive "columns" are, as it's often what people want, yet... maybe the size is as intuitive, and we just haven't tried?

folletto avatar Jul 03 '17 11:07 folletto

I like that line of thinking, Davide — a simple "rule" to replace several more complex ones. However right now, if you insert 5 images in a 3 column gallery, you get this:

screen shot 2017-07-03 at 13 46 45

In this case, the thumbnail size varies based on the available space. Which obviously we could revisit, but I think it's a quite nice implementation.

jasmussen avatar Jul 03 '17 11:07 jasmussen

Yep, I think it's how flex handles it. We had a similar consideration (and following workaround) in working with the theme showcase. ;)

I think it's a good way to deal with the last line, and we shouldn't step away from it. We could just add a note that the last line will fill, regardless? And maybe in the future an option to not allow it filling. ;)

folletto avatar Jul 03 '17 11:07 folletto

Let's set a sensible default for mobile, like max 3 or 2 columns as a start.

mtias avatar Aug 04 '17 13:08 mtias

My feelings are 2 for mobile is a good point.

karmatosed avatar Aug 10 '17 14:08 karmatosed