-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix Safari 13 metaboxes from overlapping the content. #33817
Conversation
Size Change: -29 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
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.
Thanks @jasmussen! I tested this on browser stack w/ Safari 13, and also did spot checks with Safari 14, FF, Chrome.
Thank you. In my testing this was solid as well, so I'm going to land it, but give a heads-up in #core-editor to keep an eye out on any potential side effects. |
Description
Fixes #33668.
Flex is a delicate feature, especially when supporting a range of browsers. As it turns out, older versions of Safari have a pretty specific interpretation of how flex children should inherit the height of their parents. Which is to say, they do if you don't provide a percentage height.
It gets a bit more gnarly than that, but this SO comment elucidates a bit:
I have developed this patch while using Browserstack to test Safari 13, because I'm no longer on MacOS Catalina. And as best I can tell the flex rules we have in place caused a sequence of events there:
.edit-post-visual-editor
was allowed to shrink, which happened when a metabox was present. This was fixed by disallowing shrinking (flex: 1 0 auto;
instead offlex: 1 1 auto;
) and by removingflex-basis: 100%;
(more on that in a second).edit-post-visual-editor__content-area
no longer expanded to fill the void. Presumably because whenflex-basis: 100%;
was removed, inheritance there no longer worked. This was fixed by removing the explicitheight: 100%;
inline style applied to that element, and by allowing it to grow (flex-grow: 1;
).To summarize it to the best of my understanding: when we used percentages, the editing canvas didn't actually expand, causing the metaboxes to overlap it. By removing the percentages, I had to remove them from quite a few of the child items, and change those to rely in the intrinsic
align-items: stretch;
property they are given bydisplay: flex;
by default.How has this been tested?
In my testing, this threads the needle and accomplishes what it needs to in modern browsers, Chrome, Firefox, Edge and Safari 14. It also makes it all work with Safar 13. I have not tested older yet, but presume it works the same.
The behavior to test is:
Screenshots
The Safari 13 issue that ships in trunk (big GIF):
https://cldup.com/_zYngFvNTq.gif
Safari 13 after this PR is applied:
Chrome after this PR applied (should be like before):
Types of changes
Since this is a pretty sensitive part of the editor layout code, it's important to test this pretty broadly, notably with those of you with access to Safari 13. But it's still important to ensure identical behavior on modern browsers as well.
Checklist:
*.native.js
files for terms that need renaming or removal).