Closed Bug 1633192 Opened 4 years ago Closed 4 years ago

"scroll-margin" has no effect when "display: table"

Categories

(Core :: Layout: Scrolling and Overflow, defect, P3)

75 Branch
Desktop
All
defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox75 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- fixed

People

(Reporter: Matthias.Geier, Assigned: jan_firefoxdev, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++][lang=css], [wptsync upstream])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0

Steps to reproduce:

A link target element has "scroll-margin-top: 4em" (or whatever length) and "display: table".

Here's an example: https://jsbin.com/cocopasada/edit?html,css,output
"link1" works as expected, "link2" shows the erroneous behavior.

Actual results:

The target element is scrolled to the top of the page, but "scroll-margin-top" is not taken into account.

Expected results:

When "display" is anything else, "scroll-margin-top" is taken into account and the element is scrolled to the given amount below the top of the page.

I would expect the same behavior for "display: table".

Hi, I'm setting the component in order to involve the development team.
Thanks for reporting!

Status: UNCONFIRMED → NEW
Component: Untriaged → Layout: Scrolling and Overflow
Ever confirmed: true
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → Desktop

Probably the table wrapper should inherit scroll-margin. This is probably a matter of either:

Tweaking this line to check nsLayoutUtils::GetStyleFrame or, alternatively adding scroll-margin: inherit to this CSS rule.

Then verify that it fixes the bug, and write a test.

Mentor: emilio
Keywords: good-first-bug
Priority: -- → P3
Whiteboard: [lang=c++][lang=css]

Hi,
I am new to Opensource culture. I am interested in solving this bug.
can this bug be assigned to me?

Sure, please go ahead!

Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3 (Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3 (normal.)

Severity: normal → S3

Hey, I am currently trying to fix this. After adding scroll-margin: inherit and rebuilding firefox the example works as expected. How to I continue from now? It seems the next step would be to write a test. Should a follow this guide to do so?

Tests for web platform features (like this) should go into WPT.

We have some tests for scroll-margin here, you can probably copy that test making #target a display: table, after ensuring the test fails before your patch and passes after it.

Assignee: nobody → jan_firefoxdev
Status: NEW → ASSIGNED
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c7b1f73f0a11
Added 'scroll-margin: inherit;' to ua.css to make scroll-margin work on elements with 'display: table'. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/23752 for changes under testing/web-platform/tests
Whiteboard: [lang=c++][lang=css] → [lang=c++][lang=css], [wptsync upstream]
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Upstream PR merged by moz-wptsync-bot

Thanks for fixing this Jan!

(In reply to Emilio Cobos Álvarez (:emilio) from comment #14)

Thanks for fixing this Jan!

Thank you for guiding me through the process!

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

Attachment

General

Creator:
Created:
Updated:
Size: