script: Add FocusOptions argument to Element.focus and implement FocusOptions.preventScroll (#38495)

This is an implementation of the `prevent_scroll` feature in the focus
transaction system. It allows to control whether focusing an element
should prevent scrolling or not.

Spec:
https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll
Testing: Existing WPT tests

Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
This commit is contained in:
Abdelrahman Hossam 2025-08-22 22:05:32 +08:00 committed by GitHub
parent 2ac8665e03
commit 176e42d36d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 95 additions and 60 deletions

View file

@ -5075,9 +5075,6 @@
[SVGElement interface: attribute tabIndex]
expected: FAIL
[SVGElement interface: operation focus(optional FocusOptions)]
expected: FAIL
[SVGElement interface: operation blur()]
expected: FAIL

View file

@ -1,3 +0,0 @@
[preventScroll-nested-scroll-elements.html]
[focus(options) - preventScroll on nested scroll elements]
expected: FAIL

View file

@ -1,3 +0,0 @@
[preventScroll-textarea.html]
[preventScroll: true on a textarea element]
expected: FAIL

View file

@ -1,3 +0,0 @@
[preventScroll.html]
[elm.focus({preventScroll: true})]
expected: FAIL

View file

@ -5,15 +5,9 @@
[A with tabindex=invalid should not be focusable.]
expected: FAIL
[#svg-a should not be focusable by default.]
expected: FAIL
[input[type="hidden"\] should not be focusable by default.]
expected: FAIL
[text with tabindex=0 should be focusable.]
expected: FAIL
[IMG with tabindex=invalid should not be focusable.]
expected: FAIL
@ -23,15 +17,6 @@
[#summary-first should be focusable by default.]
expected: FAIL
[a with tabindex=0 should be focusable.]
expected: FAIL
[a with tabindex=-1 should be focusable.]
expected: FAIL
[#svg-text should not be focusable by default.]
expected: FAIL
[a should not be focusable by default.]
expected: FAIL
@ -46,7 +31,3 @@
[a#with-href with tabindex=invalid should not be focusable.]
expected: FAIL
[text with tabindex=-1 should be focusable.]
expected: FAIL