Closed jcrben closed 2 years ago
@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 https://github.com/w3c/csswg-drafts/issues/129#issuecomment-893052191 )
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.
<!DOCTYPE html>
<div style="overflow: scroll; padding: 10px; border: solid; width: 100px; height: 100px;">
<div style="width: 100px; height: 100px; background: lime;"></div>
</div>
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:
<!DOCTYPE html>
<div style="overflow: scroll; padding: 10px; border: solid; width: 100px; height: 100px;">
<div style="width: 100px; height: 0; background: lime;"></div>
</div>
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.
<!DOCTYPE html>
<div style="overflow: scroll; display: block; padding: 10px; border: solid; width: 100px; height: 100px;">
<div style="min-width: 90px; height: 100px; background: lime;"></div>
</div>
will be the same as
<!DOCTYPE html>
<div style="overflow: scroll; display: flex; padding: 10px; border: solid; width: 100px; height: 100px;">
<div style="min-width: 90px; height: 100px; background: lime;"></div>
</div>
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. [1] Except for the zero inflow-bounds case - this is heading out in 101 - we analyzed the library which was causing the majority of this behaviour, and doesn't affect it. I'll Adgenda+ this in a couple of months once we are in the final state.
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>veryveryverylongword</div>
</div>
These shouldn't behave the same as the alignment rectangle is different for each. E.g. in the 2nd case the div
is ~100px, rather than the width of the longest word.
If the <div>
had something like:
<div style="width: 100px; height: 100px; overflow: scroll; padding: 10px;">
<div style="min-width: min-content;">veryveryverylongword</div>
</div>
Then the test cases would behave the same.
Ian
The CSS Working Group just discussed [css-overflow-3] Clarify padding in overflow content
, and agreed to the following:
RESOLVED: Always require inline-end padding to be added against the inline-end alignment edge for block/flow layout when it’s a scroll container, thus matching the tests.
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 Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1776328 WebKit: https://bugs.webkit.org/show_bug.cgi?id=241950
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
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.