Files
servo/components/script
Steven Novaryo e05e9730e7 dom: Focus scroll to the element only if it is not visible (#40447)
Currently when we call a `Focus` we always scroll a focusable element to
the center of the container. However, this would causes a different
behavior where UAs wouldn't scroll when a focus is called to a visible
element. This PR add implementations following the behavior of Firefox
[nsFocusManager::ScrollIntoView](e613f4df35/dom/base/nsFocusManager.cpp (L3121)),
where we are scrolling to the element if it is not visible.

This would enhance the user experience of focusing an input element,
where we should avoid moving the element if it is visible.

Incidentally fix a calculation bug for the calculation of
`ScrollIntoView` with `nearest` block or inline option.

Testing: Private WPT for the implementation defined behavior and public
WPT for the bug.

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2025-11-28 01:52:21 +00:00
..
2025-10-02 07:51:19 +00:00