Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0fc4cef61ee8a2636012958d72d41d987dc6b3d5
https://github.com/WebKit/WebKit/commit/0fc4cef61ee8a2636012958d72d41d987dc6b3d5
Author: Ahmad Saleem <[email protected]>
Date: 2026-05-27 (Wed, 27 May 2026)
Changed paths:
M LayoutTests/fast/forms/form-submission-crash-3.html
A
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-not-processed-when-top-document-has-focused-element-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-not-processed-when-top-document-has-focused-element.html
M
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt
M Source/WebCore/dom/Document.cpp
Log Message:
-----------
Autofocus should not be processed when a subframe
has
focus or when topDocument has a focused element
https://bugs.webkit.org/show_bug.cgi?id=308393
rdar://170881575
Reviewed by Ryosuke Niwa and Tim Nguyen.
The spec [1] requires that if topDocument's focused area is not
topDocument itself, autofocus candidates should be emptied and
autofocus marked as processed. The check belongs in flushAutofocusCandidates()
which is where the spec defines it.
Mark autofocus as processed and bail out if the top document has
a focused element, or if the focused frame is not the main frame.
[1]
https://flagged.apple.com:443/proxy?t2=DR1L0e6qZ7&o=aHR0cHM6Ly9odG1sLnNwZWMud2hhdHdnLm9yZy9tdWx0aXBhZ2UvaW50ZXJhY3Rpb24uaHRtbCNmbHVzaC1hdXRvZm9jdXMtY2FuZGlkYXRlcw==&emid=746e7f41-2753-4e9d-8c10-573f8c79b581&c=11
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::flushAutofocusCandidates):
*
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document-expected.txt:
Progression
*
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-not-processed-when-top-document-has-focused-element-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/autofocus-not-processed-when-top-document-has-focused-element.html:
Added.
* LayoutTests/fast/forms/form-submission-crash-3.html:
Updated crash test to not depend on autofocus to complete. The test
validates that form removal during submission does not crash; the
prior version relied on an autofocus-triggered onfocus handler to
remove the form, which no longer fires now that autofocus is
correctly skipped when another element has focus.
Canonical link:
https://flagged.apple.com:443/proxy?t2=DP1K4R1ev4&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE0MDAwQG1haW4=&emid=746e7f41-2753-4e9d-8c10-573f8c79b581&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications