Closed Bug 1858984 Opened 9 months ago Closed 6 months ago

Non-scrollable elements moves after focusing

Categories

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

Firefox 118
defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox118 --- wontfix
firefox119 --- wontfix
firefox120 --- wontfix
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- verified

People

(Reporter: David.Gausmann, Assigned: dlrobertson)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(3 files)

Attached file SliderProblem.htm

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

Steps to reproduce:

Click on the sliders in the attached file.

Actual results:

The sliders will move to top and remain there, event after page reload (F5). After page reload without cache (Ctrl + F5) the position is ok, until you click again.

Expected results:

The sliders should remain in their position.
In Chrome and in old Firefox versions this worked fine.

I already did a bisection and got this result:

Element.focus() now centers an element in the block and inline
directions when the element should be scrolled into view. Update tests
to account for this.

Differential Revision: https://phabricator.services.mozilla.com/D183541

The bisection result was not copied completely:

2023-10-13T16:54:46.943000: INFO : Narrowed integration regression window from [2d64faa1, 7ffbd729] (3 builds) to [ae30a1ac, 7ffbd729] (2 builds) (~1 steps left)
2023-10-13T16:54:46.955000: DEBUG : Starting merge handling...
2023-10-13T16:54:46.955000: DEBUG : Using url: https://hg.mozilla.org/integration/autoland/json-pushes?changeset=7ffbd7298f7b4d38aad4c5af4e08a00e626d2c09&full=1
2023-10-13T16:54:46.956000: DEBUG : redo: attempt 1/3
2023-10-13T16:54:46.956000: DEBUG : redo: retry: calling _default_get with args: ('https://hg.mozilla.org/integration/autoland/json-pushes?changeset=7ffbd7298f7b4d38aad4c5af4e08a00e626d2c09&full=1',), kwargs: {}, attempt #1
2023-10-13T16:54:46.962000: DEBUG : urllib3.connectionpool: Resetting dropped connection: hg.mozilla.org
2023-10-13T16:54:48.390000: DEBUG : urllib3.connectionpool: https://hg.mozilla.org:443 "GET /integration/autoland/json-pushes?changeset=7ffbd7298f7b4d38aad4c5af4e08a00e626d2c09&full=1 HTTP/1.1" 200 None
2023-10-13T16:54:48.474000: DEBUG : Found commit message:
Bug 1842679 - Update test expectations for Element.focus change. r=emilio,credential-management-reviewers,devtools-reviewers,sgalich,ochameau

Element.focus() now centers an element in the block and inline
directions when the element should be scrolled into view. Update tests
to account for this.

Differential Revision: https://phabricator.services.mozilla.com/D183541

2023-10-13T16:54:48.474000: DEBUG : Did not find a branch, checking all integration branches
2023-10-13T16:54:48.476000: INFO : The bisection is done.
2023-10-13T16:54:48.479000: INFO : Stopped

Status: UNCONFIRMED → NEW
Component: Untriaged → Layout: Scrolling and Overflow
Ever confirmed: true
Product: Firefox → Core
Regressed by: 1842679

Set release status flags based on info from the regressing bug 1842679

:dlrobertson, since you are the author of the regressor, bug 1842679, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(drobertson)

The diff listed is a testing diff. The regressing diff is https://phabricator.services.mozilla.com/D183512, but I've got some ideas as to what is happening here, so I'll investigate.

Flags: needinfo?(drobertson)

Ah, if it was my patch what regressed and you don't have the cycles lmk and I can look.

Thanks! I might reach out with questions, but this is a good re-intro into rr... Its been a couple months and I've already forgotten things :p I'll be debugging this today ni? myself as a reminder to post what I've found.

Flags: needinfo?(drobertson)

Set release status flags based on info from the regressing bug 1842679

Took a bit to figure this out, but I'll post a fix shortly. The element is in a overflow:hidden container, so it is sort-of scrollable, so we will attempt to scroll the target into view when it is clicked. The bug appears to be in ComputeNeedToScroll (layout/base/PresShell.cpp:3318-3320). In this particular case the line size is greater than that of the target rect to scroll into view. As a result, ComputeNeedToScroll will always return true, even though the element is visible.

Flags: needinfo?(drobertson)

Add test to ensure that a element focus with a short line size does not
unnecessarily scroll an element.

Assignee: nobody → drobertson
Status: NEW → ASSIGNED

When the line scroll amount is larger than that of the rectangle to
scroll into view, do not use the line size to determine if we should
scroll.

Depends on D192869

Is this ready to land?

Flags: needinfo?(drobertson)

(In reply to Ryan VanderMeulen [:RyanVM] from comment #11)

Is this ready to land?

Thanks for the ping! I returned from PTO today, and will land ASAP.

Flags: needinfo?(drobertson)
Pushed by drobertson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0aad09d9cd3f
Test that focus does not unnecessarily scroll. r=emilio
https://hg.mozilla.org/integration/autoland/rev/03881cb508be
Fix ComputeNeedToScroll with large line sizes. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43396 for changes under testing/web-platform/tests

Backed out for causing dt failures on browser_markup_dragdrop_reorder.js

Backout link

Push with failures

Failure log

Flags: needinfo?(drobertson)
Upstream PR was closed without merging
Severity: -- → S3
Priority: -- → P2
Flags: needinfo?(drobertson)
Pushed by drobertson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0eb9a79316cb
Test that focus does not unnecessarily scroll. r=emilio
https://hg.mozilla.org/integration/autoland/rev/271462f27193
Fix ComputeNeedToScroll with large line sizes. r=emilio,devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Upstream PR merged by moz-wptsync-bot
Duplicate of this bug: 1874867

Newly introduced WPT test focus/focus-large-element-in-overflow-hidden-container.html is failing on Chrome and Safari. Can someone help double check if the test is written correctly and/or why this is the correct new behavior? Thanks.

It would appear that the focus border might be a little bit smaller on chrome. It looks like if I reduce the error indicator box to 3px, the bug will still be caught (firefox release still fails), but chrome and firefox nightly still pass.

(In reply to dizhangg from comment #21)

Newly introduced WPT test focus/focus-large-element-in-overflow-hidden-container.html is failing on Chrome and Safari. Can someone help double check if the test is written correctly and/or why this is the correct new behavior? Thanks.

Created an update to fix this here

I just merged Dan's PR to fix the test. The fixed version passes in WebKit and Chromium, as shown here in the wpt.fyi view of the PR results:
https://wpt.fyi/results/focus/focus-large-element-in-overflow-hidden-container.html?sha=499099f083&label=pr_head

(--> Canceling dizhangg's needinfo since I think that closes out that concern.)

Flags: needinfo?(dizhangg)
Duplicate of this bug: 1844326
Flags: qe-verify+

Reproduced the issue with Firefox 120.0a1 (2023-10-13) on Windows 10x64. The sliders will move to the top and remain there after being activated and remain in that position after a refresh.
The issue is verified fixed with Firefox 123.0b2 on Windows 10x64, macOS 12 and Ubuntu 20.04. The slider will no longer change position after being activated.

Status: RESOLVED → VERIFIED
Has STR: --- → yes
Flags: qe-verify+
Duplicate of this bug: 1865667
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: