mirror of
https://github.com/servo/servo
synced 2026-05-15 11:26:50 +02:00
Previously, when we click any element, it would trigger "scroll into view". What's worse, for an anchor `<a>`, clicking it would "scroll into view" instead of navigating to the url until you retry the click. The reason is that we built `scrollIntoView` into the focus transaction system with default option. However, the default `preventScroll` for `FocusOption` is false according to spec, which triggers "scroll into view" by default with focus triggered by interaction. This PR 1. Adds spec document for those which really expects "scroll into view", i.e. `<form>` when validating data. 2. Make sure when we begin focus transaction, we prevent "scroll into view". 3. `Focus` method of element/document stays unchanged, which by default scroll into view if no parameter provided according to spec. Testing: Manually tested on `servo.org` and other websites, and examples with `<form>` still correctly scroll into view when validation fails. Fixes: #38616 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
74 KiB
74 KiB