script: Move "scroll into view" call out of "focusing steps" (#43842)

`HTMLOrSVGElement#focus` specifies the "scroll into view" steps should
be run after focusing. This was happening implicitly as part of the
`Document`'s implementation of the "focusing steps." That behavior is
not in the specification, so this change moves the scrolling call to
where it is specified. Along with making the code match the
specification, this change simplifies it as well.

Testing: This should not modify behavior, so existing tests should
suffice.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-04-01 23:40:13 +02:00
committed by GitHub
parent 155016354c
commit a486ed525e
9 changed files with 94 additions and 113 deletions

View File

@@ -6,10 +6,9 @@ use bitflags::bitflags;
use script_bindings::root::DomRoot;
use crate::dom::Node;
use crate::dom::bindings::codegen::Bindings::HTMLOrSVGElementBinding::FocusOptions;
pub(crate) enum FocusOperation {
Focus(FocusableArea, FocusOptions),
Focus(FocusableArea),
Unfocus,
}