Closed Bug 1708303 Opened 3 years ago Closed 3 years ago

scroll-margin is not respected -> element.focus() is outside of the viewport

Categories

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

Firefox 88
defect

Tracking

()

VERIFIED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: tuxle, Assigned: emilio)

Details

Attachments

(2 files)

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

Steps to reproduce:

When using element.focus() on elements with scroll-margin firefox does should always scroll the viewport so that the element including the scroll-margin are inside the viewport.

Actual results:

Firefox does not scroll if the element is outside the viewport by less than the scroll-margin resulting in elements having :focus that are not visible.

Expected results:

Firefox should have scrolled the element in the viewport and then scrolled further by scroll-margin if possible

The Bugbug bot thinks this bug should belong to the 'Core::Panning and Zooming' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Panning and Zooming
Product: Firefox → Core
Component: Panning and Zooming → Layout: Scrolling and Overflow

Yeah, the issue is that some of these things scroll "only if needed", but we account for scroll-margin too early, and use the inflated rect to determine whether the thing is already visible.

Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true

So that margin is not included in the rect for visibility calculations,
and padding and margin are accounted properly on them.

I would love to test that patch.
I built a minimal example: https://data.estada.ch/firefox_scroll-margin_bug/
Can you use that as a test?

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8befa6dc66fd
Fix scroll-margin implementation. r=hiro
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28856 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch

Tested it with nightly 90.0a1 (2021-05-06) (64-bit) and it works!
Thank you!

Status: RESOLVED → VERIFIED
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: