Closed Bug 1560406 Opened 5 years ago Closed 2 years ago

Consider scroll padding for URL anchors

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: sebo, Assigned: hiro)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file scrollsnapping.html

Scroll padding needs to be applied when accessing a URL with an anchor in it.

See the related note within the specification.

I've taken Rachel Andrew's example and adjusted it a bit. Now, if you access it using #section2 as anchor, you'll see that the element is partly hidden behind the fixed header.
Though it should be completely shown like when using other scroll actions.

Note that Chrome correctly applies the scroll padding in this case.

Sebastian

I will check the test case later, but we basically support scroll-padding on anchor (see a wpt, Chrome doesn't pass the test case there)

Flags: needinfo?(hikezoe)

OK, I think I know what the problem is. This is basically due to the fact our current PresShell::ScrollFrameRectIntoView was set up for position-based scrolling but it doesn't fit well to the new scroll snap based on elements. This issue is one of my concerns since I implemented the new scroll snap and I did want to fix it before implementing scroll-snap-stop, but I probably fix this before it.

Assigning to myself, but P3 for now.

Assignee: nobody → hikezoe
Status: NEW → ASSIGNED
Flags: needinfo?(hikezoe)
Priority: -- → P3

The reason why Chrome fails the test is because the scroll-padding is set on the <html> element. If it is set on the <body> element, the test passes (and still fails in Firefox). So there should probably be another web platform test created to cover that case.

Sebastian

Fixed by bug 1771830.

Blocks: 1771830
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

Thanks for the note and the fix, Hiro! I can confirm that it's working as expected now.

Sebastian

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: