scroll-snap not working on empty sized generated content
Categories
(Core :: Layout: Scrolling and Overflow, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox132 | --- | fixed |
People
(Reporter: bramus, Assigned: hiro)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Steps to reproduce:
The scroll-snap spec includes ^1 the following example on how to make sure an element remains snapped at the bottom
.log {
scroll-snap-type: y proximity;
align-content: end;
}
.log::after {
display: block;
content: "";
scroll-snap-align: end;
}
Actual results:
When building a demo that uses this CSS ^2, it does not seem to work in Firefox – see attached recording - whereas in other browsers (Chrome/Safari) it does.
Expected results:
As per spec, this example should work.
Noteworthy is that when changing the snapping from ::after to :last-child ^3, it does work fine. This leads me to the conclusion that scrol-snapping does not work properly on generated content.
Comment 1•1 year ago
|
||
The severity field is not set for this bug.
:hiro, could you have a look please?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 2•1 year ago
|
||
Thanks Bramus for filing this issue.
To be precise what the real problem is that the generated content in question is empty sized because of content: "", if the property is something like content: "after", then things work fine.
The problem in code is here in ScrollSnapInfo::ForEachValidTargetFor, we use BaseRect::Intersects which unfortunately returns false for empty size rectangle.
| Assignee | ||
Comment 3•1 year ago
|
||
Also this change treats edge cases
(e.g. snappedPort.x == target.mSnapArea.XMost()) as valid, I think it would be
better results.
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Thanks for digging into this, Hiroyuki. It’s clear to me now that authors can add something like min-height: 1px to the generated content in order to work around this bug.
Comment 7•1 year ago
|
||
| bugherder | ||
Description
•