Gallery Block: Think up responsive feature
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?
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.
I'd honestly leave this up to the theme to decide (via CSS).
I could give that a 👍
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?
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:
- Implementation is a straight build on
flex. - No lies: the number of columns is dependent on screen size, and we acknowledge it.
- No dependency on the theme column width.
Cons:
- 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?
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:

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.
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. ;)
Let's set a sensible default for mobile, like max 3 or 2 columns as a start.
My feelings are 2 for mobile is a good point.