Open Bug 1731491 Opened 3 years ago Updated 3 years ago

Moving focus into sticky header should not scroll page by scroll-padding/scroll-margin amount

Categories

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

Firefox 94
defect

Tracking

()

People

(Reporter: sime.vidas, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.0

Steps to reproduce:

This issue was reported on the web.dev repo a few months ago: https://github.com/GoogleChrome/web.dev/issues/5413

The report provides the following test page (read the instructions on that page): https://codepen.io/robdodson/pen/MWpKOOK

Actual results:

If the user presses Shift + Tab to move focus back to the sticky header, the page scrolls a bit.

Expected results:

The scroll position should not change because the sticky header is always visible.

I have found that the same issue occurs when using scroll-margin instead of scroll-adding, so the issue affects both properties.

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

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

So it seems Chrome scrolls all the way to the static position (so all the way to the top), right? Not sure that's a lot better...

That’s not what I’m seeing in my Chrome (on macOS). Every time I try it, it scrolls up by exactly 176 pixels, for some reason.

So to be clear, you have to

  1. click once on the text where it says ”Click here”
  2. scroll down by a fair amount (a couple of pages) without clicking anything
  3. press Shift + Tab to focus the Menu button in the header

Tip: In Chrome DevTools in the Console, you can add a live expression (the eye icon). If you paste document.documentElement.scrollTop, it will always tell you the current scroll position, so it will be easier to tell by how much it changed when you press the keyboard command.

The severity field is not set for this bug.
:hiro, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(hikezoe.birchill)

If the target sticky element is totally visible, to me any scroll operation shouldn't happen. But if the element is half visible, scroll-padding/scroll-margin should be applied?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(hikezoe.birchill)
You need to log in before you can comment on or make changes to this bug.