Closed Bug 1743045 Opened 4 years ago Closed 3 years ago

Smooth scroll preference is ignored for element.scrollIntoView

Categories

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

Firefox 95
defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox94 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox97 --- wontfix
firefox112 --- fixed

People

(Reporter: matthias, Assigned: dlrobertson)

References

Details

(Keywords: access)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0

Steps to reproduce:

I have configured my browser with 'smooth scrolling: disabled', then clicked on an element which triggered an element.scrollIntoView({behaviour: 'smooth'}) action.

Example: clicking 'next' on a comment in an HN thread: https://news.ycombinator.com/item?id=29341390

Actual results:

The window, during some 150ms, smoothly scrolled to the element, whilst adding unwanted extra strain onto my eyes.

Expected results:

The window immediately jumps to the element. The user preferences are used instead of the JS value.

Summary: Smooth scroll scrollintoview preference → Smooth scroll preference is ignored for element.scrollIntoView

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

Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Component: JavaScript Engine → DOM: Core & HTML

Hi Matthias,

I tested your issue on the latest Nightly 96.0a1, on Beta 94.0 and currente release 94.0 and I did reproduce it, so I´ll tag this as "New" for visibility.

Let´s wait a for a developer to look into this.

Thanks,

Estanislao

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: DOM: Core & HTML → Layout: Scrolling and Overflow

I moved this to layout, because I think it would make more sense to check the pref there (in PresShell::ScrollContentIntoView?) instead of in every place that we trigger a scroll. If we need to fix it in the DOM API this would be the location instead: https://searchfox.org/mozilla-central/source/dom/base/Element.cpp#761

Keywords: access
See Also: → 1794328
Assignee: nobody → drobertson

For programmatic scrolls, we should respect a users general.smoothScroll
preference. If smooth scrolls are disabled, programmatic scrolls with
behavior: "smooth" should be treated as instant programmatic scrolls.

Pushed by drobertson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c33204e69e49 Respect general.smoothScroll for programmatic scrolls. r=hiro

Added fix to the patch last night.

Flags: needinfo?(drobertson)
Pushed by drobertson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/05981db2f726 Respect general.smoothScroll for programmatic scrolls. r=hiro

Backed out for causing failures on test_group_scrollend.html

[task 2023-02-23T01:49:34.312Z] 01:49:34     INFO - TEST-PASS | gfx/layers/apz/test/mochitest/test_group_scrollend.html | helper_basic_scrollend.html?chrome-only=true | A scrollend event should be triggered after instant scroll 
[task 2023-02-23T01:49:34.313Z] 01:49:34     INFO - Buffered messages finished
[task 2023-02-23T01:49:34.314Z] 01:49:34     INFO - TEST-UNEXPECTED-FAIL | gfx/layers/apz/test/mochitest/test_group_scrollend.html | Test timed out. - 
[task 2023-02-23T01:49:35.181Z] 01:49:35     INFO - GECKO(2783) | MEMORY STAT | vsize 2590MB | residentFast 172MB | heapAllocated 10MB
[task 2023-02-23T01:49:36.205Z] 01:49:36     INFO - TEST-OK | gfx/layers/apz/test/mochitest/test_group_scrollend.html | took 329740ms
[task 2023-02-23T01:49:39.215Z] 01:49:39     INFO - Error: Unable to restore focus, expect failures and timeouts.
Flags: needinfo?(drobertson)
Flags: needinfo?(drobertson)
Pushed by drobertson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fba053844000 Respect general.smoothScroll for programmatic scrolls. r=hiro
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Blocks: 1794328
See Also: 1794328
Regressions: 1825681
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: