Skip to content
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

Gutenberg: Make content scrollable again #28149

Merged
merged 1 commit into from
Oct 29, 2018

Conversation

Copons
Copy link
Contributor

@Copons Copons commented Oct 29, 2018

Changes proposed in this Pull Request

Testing instructions

Fixes issue reported in #28095 (comment)

@Copons Copons added [Type] Bug [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Goal] Gutenberg Working towards full integration with Gutenberg labels Oct 29, 2018
@Copons Copons self-assigned this Oct 29, 2018
@matticbot
Copy link
Contributor

@Copons Copons requested review from jasmussen and a team October 29, 2018 15:40
Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted before, I couldn't reproduce this issue in wpcalypso. I tested the new changes and everything still works as expected. The code looks good and since this fixes the issue for you it's good to ship. :shipit:

@vindl vindl added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Oct 29, 2018
@Copons
Copy link
Contributor Author

Copons commented Oct 29, 2018

I'll ship this for now as it's rather important for us to be able to scroll the content, but I'd still love @jasmussen's opinion, because I couldn't repro the original issue. 🙇

@Copons Copons merged commit 564fd7b into master Oct 29, 2018
@Copons Copons deleted the fix/gutenberg-scrollable-content branch October 29, 2018 15:55
@jasmussen
Copy link
Member

So, stepping back a bit, the reason that overscroll-behavior-y: none is to allow us to disable the overscroll bounce effect that happens notably on Mac browsers. This is when you have scrolled to the end of a container, and continue scrolling, you sort of pull at the canvas to indicate that no, you're done, you're at the end of the content here. overscroll-behavior-y: none disablees that.

Why would you do that, you might ask? Because if you are using flexbox to create layouts, you might want a container element that is not the body element to scroll. In the case of Gutenberg, this element is .edit-post-layout__content. By letting this element scroll, we gain a number of benefits:

  • We can let the editor bar (top action bar) behave as if it's fixed position, without actually using position: fixed;
  • We can prevent scroll bleed from other scrollable elements, like the Block Library
  • We can prevent double scrollbars, in situations where the Settings sidebar needs to scroll
  • We can greatly simplify much of the layout CSS

The downside to using flexbox is usually iPads. On an iPad it has enough screen real estate to view the desktop view for the editor, which uses this flexbox for layout. Which means if you swipe with your finger on the scrollable canvas, that scrolls, cool. But when you drag with the finger on the app bar, you move the body element, and invoke the scroll bounce effect, when perhaps you actually meant to scroll the content below.

Sadly overscroll-behavior-y does not work on iPads, so it doesn't fix that. But for now we are keeping the flex layout because it addresses the issue of scroll bleed. Compare:

no scroll bleed

scrollbleed

In Calypso, when you scroll to the end of the block library, you start scrolling the content below. This issue is likely to become more prevalent once modals appear, like the keyboard shortcuts sheet.

It also fixes the issue with the double scrollbar, which is not present in the core version:

screenshot 2018-10-30 at 09 05 46

In other words, for now we are relying on the benefits of the flex layout, in order to solve the scroll bleed issue, and hoping that a future version of Safari will support the overscroll-behavior-y property. For iPhones there's a separate fix.

From what I can tell, the Calypso version of Gutenberg rejiggers this layout to not use flexbox for the editor bar. I'm not sure why, but if this behavior is to be kept, it's worth looking into other ways to solve the scroll bleed issue.

@Copons
Copy link
Contributor Author

Copons commented Oct 30, 2018

@jasmussen Thank you so much for the detailed explanation!
I still can't see the bounce, but now it's clear to me that the issue is about the div behind scrolling when the div in front reached its scroll end.
I'll open an issue about this and we'll try to take care of it appropriately. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg [Type] Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants