-
Notifications
You must be signed in to change notification settings - Fork 719
[css-overflow-3] Clarify padding in overflow content #129
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
Comments
It was never clear in 2.1. Overflow 3 is clear about it - padding should be included - but it's not 100% clear that's web-compatible. In particular, Chrome only includes padding in the block axis, and as you found, Firefox/IE don't include it in either axis. We need to dig thru this as a group and figure out what we should be doing. |
We discussed this on the call today. I've added an issue to the spec for it. |
In WebKit, we actually have different policies for block children and inline children. If the scroll container has inline children, we will include padding-right (or the equivalent for different writing modes) when computing layout overflow. However, if the scroll container has block children, we just consider the border boxes of the children. This is why there was some disagreement in the call today about what the policy is for the inline-direction. |
Since additional information is being added here, and we haven't solved the original issue, I'm reopening this despite also having an inline issue in the spec. |
@litherum Very interesting. Do you know if the decision to behave differently in the inline direction was informed by compat issues? I would not be surprised that adding the padding in the inline direction if the scroll container has block children was causing scroll bars to appear in places where they're not wanted, and had to be avoided because of that. |
@litherum I thought it might be something like that; I'm glad to hear it's that simple, and I'll edit the issue accordingly. I echo @frivoal's question about whether the "don't include if if there's only block children" was done for compat (y'all were seeing pages suddenly sprout lots more scrollbars than intended), or if it was just happenstance (y'all added a hack to make inline content look better, and just didn't apply it generally). |
@litherum Ping on:
|
This code is older than my time on the WebKit team. I'll ask tomorrow. |
@tabatkins Do you know whether firefox will fix this bug https://bugzilla.mozilla.org/show_bug.cgi?id=748518 ? |
Sebastian |
My two cents are that we will change behavior here no more than once. That means the WG needs to get its act together and figure out what it's doing before we make any changes. |
From a web developers view the Chrome behavior makes much more sense. |
@litherum On June 22, 2016, you said:
Unless you live in a very unusual time zone, I think we're past tomorrow :) Any update? |
Gecko is close to the spec (and I like it, most of the time) but the Blink implementation makes more sense in this case. |
@frlinw I think historically the issue is that browsers didn't want to trigger scrollbars for Unfortunately, browsers only measure overflow in one way: either include a padding/margin or don't. And changing behavior to include padding/margin when it wasn't before can cause pages which previously didn't have scrollbars to suddenly have scrollbars, and this can make a problem for the page. So we're in an uncomfortable position of what to do here. I think it would be best artistically if we can count padding/margin as much as possible, but compatibility with existing Web content limits what we can do about it... |
Yes, I understand the issue here but actually, it is expected. Padding can cause overflow. Moreover, Blink has the highest market share, it does not implement the behavior introduced in CSS 2.1 and there is no screams about it (actually maybe there are screams, I really don't know, but blink team does not need 6 years to implement something the dev community wants). The issue here is the developer is not in control. The spec introduced a behavior which can be unexpected but didn't give to the developer the opportunity to control it (with something like
CSS 2.1 broke existing web content because of this change too. Web is a living thing. |
The Working Group just discussed
The full IRC log of that discussion |
To solve the Web-Compat problem one could invent a CSS property such: values are:
The actual Chrome behavior would be: The actual Firefox behavoir would be: |
@nuxodin your proposition seems good. I'm in for a css property to give some control to web authors (if there is no consensus about a default behavior) but it is not really related to the webcompat issue |
@bfgeek, just wanted to check whether there are any updates / timeline-ETAs on the proposed use-counter/webcompat-data-gathering phase, for determining whether your proposal is web-compatible? (per #129 (comment) ) This is an area of occasional interop pain (just got a bug report in https://bugzilla.mozilla.org/show_bug.cgi?id=1744414 ) so I'm looking forward to having a resolution for something coherent and (hopefully) web-compatible, so we can become interoperable. :) |
@dholbert - Getting there. We successfully shipped adding inline-end padding to blocks which already scrolled. E.g.
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=9874 We are still determining if we can add this inline-end padding universally. There is one interesting subcase which is highly prevalent:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=9875 Specifically if there appears to be one JS library which uses this pattern (an zero height element which would trigger overflow if we added padding universally). I need to study this library some more to determine if making it scrollable will cause any issues for it. The next step is likely going to be try to ship adding inline-end padding for the non-empty case. E.g.
will be the same as
This is likely going to be web compatible as the UseCounter is lower than when we made the similar change for flexbox. TL;DR at the very least we can add inline-end padding to block boxes which already scroll. But I'd like to keep pushing to try and add this universally. |
Just as a small FYI - we've shipped mostly[1] the expected behaviour in Chromium 99. |
As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855
As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561758 Reviewed-by: David GroganCommit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#996995}
As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561758 Reviewed-by: David GroganCommit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#996995}
As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561758 Reviewed-by: David GroganCommit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#996995}
M101 is rolling at the moment for us. I added the tests for the padding edge behaviour in: All of the tests in that file roughly have this form:
">
<style> scrollable-container { display: block; width: 100px; height: 100px; overflow: scroll; padding: 10px 5px; } scrollable-container > div { width: 200px; height: 0; /* The child has zero area - so shouldn't directly contribute to scrollable overflow. */ position: relative; left: -1000px; /* Additionally it is rel-pos'd before the scroll origin. */ margin-right: 50px; /* end margin to push out the padding edge. */ } style> <scrollable-container data-expected-scroll-width="260"> <div>div> scrollable-container> The test does this for various writing-mode + direction combinations + block/inline level children. Currently all the browsers agree on the block direction scrollable overflow tests. The tests check that the behaviour is the same in the inline direction. Additionally one this I also wanted to clarify was that there was some discussion in the issue that these two cases should behave the same: <div style="width: 100px; height: 100px; overflow: scroll; padding: 10px;">
veryveryverylongword
div>
<div style="width: 100px; height: 100px; overflow: scroll; padding: 10px;">
<div>veryveryverylongworddiv>
div> These shouldn't behave the same as the alignment rectangle is different for each. E.g. in the 2nd case the If the Then the test cases would behave the same. Ian |
The CSS Working Group just discussed
The full IRC log of that discussion |
…ow tests., a=testonly Automatic update from web-platform-tests [css-overflow] Update/add padding overflow tests. As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561758 Reviewed-by: David GroganCommit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#996995} -- wpt-commits: c207c7528927fb4c7b2644588614dbac4ecb12f2 wpt-pr: 33833
…ow tests., a=testonly Automatic update from web-platform-tests [css-overflow] Update/add padding overflow tests. As per: w3c/csswg-drafts#129 https://crbug.com/1245722 We've sucessfully shipped the logic to include padding in the scrollable overflow of elements. This patch updates the tests, and adds some new ones. Fixed: 1245722 Change-Id: I5f0fa14429da2d8f99efd95b071c6fc2e2c59855 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561758 Reviewed-by: David GroganCommit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#996995} -- wpt-commits: c207c7528927fb4c7b2644588614dbac4ecb12f2 wpt-pr: 33833
Hi everyone, I'm allowing to comment on this issue to have a clarification about a problem I am facing. When working with grid whose content is overflowing, applying a padding is now honored in the scrolling container (which is what as a developer I expect), however this only works if columns are sized in PX. As soon as elements as expressed as a percentage of the parent, this fails and we have here as well an unintuitive behavior. The issue can be reproduced here: https://codepen.io/bakura10/pen/VwQJEJL Is this expected as per spec, or is this an implementation issue of browsers (speaking about that, Safari gives a completely different result from other browsers). |
That looks pretty weird! Seems to be an impl bug - are you getting it in multiple browsers? |
Chrome and Firefox has a consistent result in not showing the padding end, while Safari has a completely odd output. I will send a ticket to each vendor then :). EDIT: I filled the different bugs: Blink: https://bugs.chromium.org/p/chromium/issues/detail?id=1339124 |
I left a comment at https://bugs.chromium.org/p/chromium/issues/detail?id=1339124#c1 the percentage column case is working as expected - Ian |
Uh oh!
There was an error while loading. Please reload this page.
I discovered this today when my overflow content appeared cut-off in Firefox and IE. It appears this was reported to Mozilla and closed as invalid in Bug 748518 - padding-bottom/right(block-end/inline-end) is ignored with overflow:auto/scroll because it extends in from the border-box rather than out from the scrollable area and someone there suggested bringing it up with the CSS team. I did a search for padding-bottom overflow on the www-style list and didn't see anything.
Previous practical discussions on Stack Overflow include Bottom padding not working on overflow element in non-chrome browsers and padding-bottom is ignored in Firefox and IE on overflowing elements with no content.
Perhaps this is already clear and Chrome has it wrong? I'll admit I'm not enough of an expert on the spec to be sure, just hoping for consistency.
The text was updated successfully, but these errors were encountered: