Skip to content

Commit

Permalink
Fix issue with editor styles and fullscreen (#10024)
Browse files Browse the repository at this point in the history
This is a curious one.

The topbar in WordPress takes up some space in the editing canvas. When fullscreen mode is engaged, we invoke a negative vertical margin to offset this. But this means the _body_ element is no longer 100% tall, because 32px have been cropped off.

So what happens when an editor style colorizes the body element? Well normally even though the body element isn't as tall as the viewport, it floods the whole thing. See https://css-tricks.com/just-one-of-those-weird-things-about-css-background-on-body/ for all the details.

But in this case, we have a background color on the HTML element. And we need to have that, because otherwise we can't use mix-blend-mode when selecting multiple blocks. This is due to a bug in Chrome where this feature doesn't work unless a background color that isn't none or transparent is explicitly set on the html element.

So there we go — and that's why this PR uses calc to set the height on the body element.
  • Loading branch information
jasmussen committed Sep 19, 2018
1 parent 27cc2b6 commit 1339881
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions edit-post/components/fullscreen-mode/style.scss
@@ -1,8 +1,11 @@
body.is-fullscreen-mode {
// Reset the html.wp-topbar padding
// Because this uses negative margins, we have to compensate for the height.
margin-top: -$admin-bar-height-big;
height: calc(100% + #{ $admin-bar-height-big });
@include break-medium() {
margin-top: -$admin-bar-height;
height: calc(100% + #{ $admin-bar-height });
}

#adminmenumain,
Expand Down

0 comments on commit 1339881

Please sign in to comment.