Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 74af04025b3b5da310c71d9780d3ac28eceafa9c
https://github.com/WebKit/WebKit/commit/74af04025b3b5da310c71d9780d3ac28eceafa9c
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-04 (Sun, 04 Oct 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-01-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-03-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-04-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-04.html
M Source/WebCore/dom/Element.cpp
Log Message:
-----------
SVG elements inside hidden containers should not be focusable
https://bugs.webkit.org/show_bug.cgi?id=309041
rdar://171590890
Reviewed by Chris Dumez.
According to the specification [1], a non-rendered element can never receive
focus, regardless of the value of the `tabindex` attribute. If a script
programmatically assigns focus to a non-rendered or otherwise un-focusable
element, the focusing call is aborted.
Never-rendered SVG element types (e.g. <defs>, <clipPath>, <mask>, <marker>,
<pattern>, <linearGradient>, <radialGradient>, <symbol>) and any elements
inside them are never rendered, and therefore should not be focusable either.
Add a check in Element::isFocusable() that walks the render tree starting from
the element's own renderer and returns false if it, or any ancestor, is a
RenderSVGHiddenContainer or LegacyRenderSVGHiddenContainer. Starting the walk
at the element's own renderer also rejects a hidden container that is focused
directly (e.g. <defs tabindex="0">), not only its descendants.
[1] https://w3c.github.io/svgwg/svg2-draft/interact.html#Focus
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isFocusable const):
*
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-01-expected.txt:
Progression
*
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-03-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-04.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/interact/focus-inside-hidden-svg-containers-04-expected.txt:
Added.
Canonical link: https://commits.webkit.org/322650@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications