-
Notifications
You must be signed in to change notification settings - Fork 798
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
Google Calendar block: Fix full width support #14835
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
This looks good, and works as expected. However I can't see how the height attribute is used; it doesn't seem to be working. Is that expected? |
It seems to set a default initial height of the iframe in the editor. I originally removed it, but in the editor the height of the iframe was always collapsed with no way to override this with CSS. It worked on the front end however. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The height attribute seems to be working now. LGTM...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the min-width on the iframe in the editor causes the calendar to squash to a smaller width on left and right align than on centre. Dave initially picked this up here.
I vaguely remember a discussion about this, apologies if there was and I didn't pipe up then.
@davemart-in Thoughts on the widths of left and right alignment? I do think it needs to be narrower here to allow for content to sit beside it and not also be squished: |
@glendaviesnz here's where it was discussed previously. Originating here. |
@apeatling We added a height property to the map block. Should we just add a width property/option in the sidebar here? That way the customer could set the width to whatever works best for their page. |
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: April 7, 2020. |
@davemart-in We can do that, I think the issue in my mind is how does this interact with the "full-width" and "wide" alignment options? Does it just override this width setting? |
@apeatling good question. Would it make sense to only show the width option when the alignment is left, right, or center. Or would that be too confusing do you think? Another option would be to fix the width to 100% when in full-width and wide mode and disable the control. Then maybe add a line under it saying "Full-width alignment applied", or something like that. |
There are a couple of weird behaviours going on. 🤔 I don't understand why we set the How the heck is the iframe width calculated when float aligned? 😮 |
Yeh, I couldn't for the life of me work out where that float width was being inherited from, but this does override it - 1334560#diff-6c3f07277cda5eda687f141e3ef5e805 |
It is extracted from the embed code as the user can specify custom height and width when setting up the embed - but we should also have an option for the user to change this once the block is added. |
I think we can add back the min width only when the block is aligned left and right. I pretty skeptical that adding a width control is a worthy time investment though. I think we could just set the min width to 50% when aligned left/right, and support full/wide width and move on. If we hear from users that they want to change this, then look at more fine grained control. |
All of the default themes provide default styles for alignleft and alignright floats that causes this to be really problematic. Not to mention themes like TwentyTwenty put floats in their own column with a restricted width. |
This opens of the question of how much control we should give users to do things that might not always work well. Its hard to know where to draw the line between giving them the freedom to break stuff and preventing them from creating bad designs. |
apeatling, Your synced wpcom patch D39574-code has been updated. |
Howdy! The Jetpack team has disappeared for a few days to a secret island lair to concoct new ways to make Jetpack one hundred billion percent better. As a result, your Pull Request may not be reviewed right away. Do not worry, we will be back next week to look at your work! Thank you for your understanding. |
I'd vote to do this and then call it good. |
@davemart-in It was unclear in my previous comment, but I believe this to be very hard to develop. |
The alternative is that the calendar will look broken by default on ALL themes when the alignment is set to left or right. This calendar just looks broken to me. I can't imagine that anyone would want this to show up like this on their site. Themes can always override the min-width if they want. |
@davemart-in 🤔 makes sense. I've tried with
Unfortunately Twenty Twenty's float alignment is 290px wide, so at some screen sizes the calendar would end up outside, but there's not much we can do there. |
apeatling, Your synced wpcom patch D39574-code has been updated. |
@Copons Thanks for digging into and following up on this one! 🥇 |
@Copons With your commit I think this is ready for final review, right? |
@apeatling Yes I believe so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me, it should be good to merge!
* Initial changelog entry * Changelog: add #14904 * Changelog: add #14910 * Changelog: add #14913 * Changelog: add #14916 * Changelog: add #14922 * Changelog: add #14924 * Changelog: add #14925 * Changelog: add #14928 * Changelog: add #14840 * Changelog: add #14841 * Changelog: add #14842 * Changelog: add #14826 * Changelog: add #14835 * Changelog: add #14859 * Changelog: add #14884 * Changelog: add #14888 * Changelog: add #14817 * Changelog: add #14814 * Changelog: add #14819 * Changelog;: add #14797 * Changelog: add #14798 * Changelog: add #14802 * Changelog: add #13676 * Changelog: add #13744 * Changelog: add #13777 * Changelog: add #14446 * Changelog: add #14739 * Changelog: add #14770 * Changelog: add #14784 * Changelog: add #14897 * Changelog: add #14898 * Changelog: add #14968 * Changelog: add #14985 * Changelog: add #15044 * Changelog: add #15052 * Update to remove Podcast since it remains in Beta * Changelog: add #14803 * Changelog: add #15028 * Changelog: add #15065 * Changelog:add #14886 * Changelog: add #15118 * Changelog: add #14990 * Changelog: add #14528 * Changelog: add #15120 * Changelog: add #15126 * Changelog: add #15049 * Chanegelog: add #14852 * Changelog: add #15090 * Changelog: add #15138 * Changelog: add #15124 * Changelog:add #15055 * Changelog: add #15017 * Changelog: add #15109 * Changelog: add #15145 * Changelog:add #15096 * Changelog:add #15153 * Changelog: add #15133 * Changelog: add #14960 * Changelog: add #15127 * Changelog: add #15056 * Copy current changelog to changelog archive. * Clarify changelog description
if ( empty( $url ) ) { | ||
return; | ||
} | ||
|
||
if ( class_exists( 'Jetpack_AMP_Support' ) && \Jetpack_AMP_Support::is_amp_request() ) { | ||
return sprintf( | ||
'<div class="%1$s"><amp-iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" width="%3$d" height="%4$d" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe></div>', | ||
'<div class="%1$s"><amp-iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" height="%3$d" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe></div>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change appears to have broken Google Calendar on AMP pages, since there is no width
defined, and the layout
was not changed from responsive
to fixed-height
. Opened PR to fix in #17251.
Make sure that the Google Calendar block widths match in the editor and front end, and that full and wide widths are supported correctly.
Fixes #14823
Testing instructions:
<iframe src="https://calendar.google.com/calendar/embed?src=tl4njqffodltemv385vnifrjadm345g2%40import.calendar.google.com&ctz=America%2FVancouver" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
full width
.left
andright
alignment options and confirm the width of the block matches in the front end and the editor.Note: on some themes (e.g. Twenty Twenty) the left/right positioning of this block in the front end might overflow outside of the viewport because of its
min-width
. Eventually we decided that having a readable calendar on most themes is better than having a squished calendar on all themes. (See discussion in the PR comments)Proposed changelog entry for your changes: