-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spacer Block Not Responsive, May Lead to Unexpected Results #10081
Comments
'If' this can be done without any interface in phase one, I would prefer that. I can see a need once we enter site building to have more granular control but for now having something 'just work' seems like the best step. |
Completely agreed. In fact I don't think there should be interface. It strikes me as a fairly reasonable assumption that users inserting a spacer are defining the height they want at the current document width, so a ratio-based "just works" solution makes sense. If users wanted to optimize heights at different breakpoints, I would think that's plugin-territory for a "Show only on [mobile/desktop]" feature (unless/until core added standardized responsive options for blocks). |
I wonder if there's any way to re-use or extend the CSS used in the responsive video feature? Maybe similarly calculating the aspect ratio on the fly somehow…? |
Removing the design feedback as we are opting for no interface so it's just a matter of a pull request on this now. I say that knowing 'just' involves some 'fun' maths. |
Isn't the core issue here that using PX as the primary/only unit type is guaranteed to lead to issues related to changing viewport size? Why not allow something based off vh or em? |
@DancingPigeon That's certainly another way to put it. In trying to think about the ideal "just works" experience, something close to maintaining the aspect ratio of the sizer feels right, though I also think that it might be even better if there were min- and max-heights to "cap" the changes. Something similar is usually done when using vw units for type sizing. ems wouldn't maintain aspect ratio and only be responsive if the theme resizes typography, but vh units seem like a reasonable path forward. I didn't think the browser support was there, but reviewing that now (IE9+), makes me think that could be an even cleaner solution than the pseudo-element aspect ratio hack. |
I can see arguments for either. Personally, I think dragging by PX is the least valuable way for the 'standard' user to use the current control, and its certainly at odds with the current trend in how white space should be handled with respect to content. I can see an argument for either vh or em, depending of course whether we're talking about space as it relates to typography or viewport. I can see value in either, for different purposes of spacing. |
Maintaining aspect ratio and scaling down proportionally, IMO, is key. It should feel proportionally like the same amount of space, despite your screen size (though I agree we need a min/max cap). Pixels are easier to visualize when deciding how large something is — but the actual output should probably be something more flexible, like |
I would love to be able to customize the available spacer-heights, similar to how it is possible with the editor font sizes. For example:
Resulting in the following markup: <div class="wp-block-spacer is-large" aria-hidden="true"></div> |
@dweidner seems like a good suggestion. I'd encourage you to make a separate ticket for that request as the direction of this ticket right now is probably UI-less. |
I think we all would love that solution. Until they implement something like that, I have coded a simple vanilla lightweight solution which you can configure with breakpoints. I hope it helps :) Source -> https://codepen.io/Wondermochi/pen/YbGQdW Edit: It looks like Gutenberg overwrite my javascript (even when I render it on head omg). Can someone tell why? Finally I decided to set an !important height value to all spacer blocks which I can control from my css to optimize space in every breakpoint. In case of needen more space, I will add the block twice. Not clean but functional. |
At lest using more units options would help a lot, i.e. vw, wh, em, % etc. |
Any news on this? |
The Spacer block now supports different units for height, not just pixes, so I think we can close this issue. See #36186. |
I'll just throw out that I think until the default value of the spacer block is changed to a responsive value ( |
Please lock my account that is not me changing it.
…On Fri, Jan 14, 2565 BE at 7:40 AM Mark Root-Wiley ***@***.***> wrote:
I'll just throw out that I think until the default value of the spacer
block is changed to a responsive value (5vh?), the usability concerns
expressed in this ticket—default usage leads to unresponsive bad results on
small screens—are still valid.
—
Reply to this email directly, view it on GitHub
<#10081 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AU6ET4SMH4EHNTHJTZYTDDLUWBGZPANCNFSM4FWL5P3A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@mrwweb - I'm seeing |
@jordesign I would not say that the addition of I think until |
@mrwweb Having that value as the default is likely a much bigger conversation to have - in terms of consistency with other blocks etc. I'll leave this open - but add a label for Design Feedback 👍 |
Totally agree. The original concern with the ticket is that any user that doesn't have a strong grasp of I don't think that has changed, so I agree we should leave the ticket open. I'd love design feedback! |
Describe the bug
The Spacer block is quite simple in that it applies a fixed height in pixels set by the editor.
To quickly take a step back, one general problem with WYSIWYG editors is that they encourage editors to overly optimize for the environment they're currently working in. This can lead to unintended consequences of editor decisions, often without the editor's knowledge.
Back to the issue, I think the Spacer likely will lead to unexpected results for editors when using this block on a large screen and not considering small screens. Arguably worse, even if editors want to consider small screens, there's no easy way to do so.
The screenshots below illustrate the issue. On my current monitor with a browser not even filling the entire screen, this spacer filled roughly 40% of the screen height. On an iPhone 7-size screen, it was 55%. It's not that hard to imagine a user making spacers that approach 100% of a smaller phone's screen.
I'm not sure of the best solution for this, but my first instinct would be that the spacer should be calculating a height as percentage of width and then implemented with a pseudo-element in the classic aspect ratio box technique. I'm sure there are other possibilities both for the behavior and implementation.
To Reproduce
Expected behavior
Spacer adjusts to be reasonable on and screen size.
Screenshots
If applicable, add screenshots to help explain your problem.
Full Post on large screen
One screen's worth of the post on large screen:
Full Post on Small Screen
One screen's worth of the post on a small screen
The text was updated successfully, but these errors were encountered: