Skip to content

Fix a bug in this test that the host wasn't getting focused. - #35257

Merged
rniwa merged 1 commit into
web-platform-tests:masterfrom
rniwa:fix-css-focus-visible-020
Jul 28, 2022
Merged

rniwa merged 1 commit into
web-platform-tests:masterfrom
rniwa:fix-css-focus-visible-020

Conversation

@rniwa

@rniwa rniwa commented Jul 28, 2022

Copy link
Copy Markdown
Contributor

HTML defines steps to run when an element is inserted into a document (i.e. document tree),
not anytime an element is connected to a document:
https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute

HTML defines steps to run when an element is inserted into a document (i.e. document tree),
not anytime an element is connected to a document:
https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute
@rniwa
rniwa merged commit c86f08b into web-platform-tests:master Jul 28, 2022
@rniwa
rniwa deleted the fix-css-focus-visible-020 branch August 2, 2022 18:00
Rinkubot pushed a commit to Rinkubot/Webkit that referenced this pull request Sep 3, 2025
    Update delegatesFocus to match recent spec changes
    https://bugs.webkit.org/show_bug.cgi?id=232564

    Reviewed by Darin Adler.

    Implemented the new behavior of focusDelegates and added the support for autofocus focus delegation.
    Also fixed a bug that an element with autofocus content attribute inside a shadow tree gets focus.

    See whatwg/html#7079

    * LayoutTests/fast/shadow-dom/autofocus-in-shadow-tree-autofocus-host-expected.txt: Added.
    * LayoutTests/fast/shadow-dom/autofocus-in-shadow-tree-autofocus-host.html: Added.
    * LayoutTests/fast/shadow-dom/autofocus-in-shadow-tree-expected.txt: Added.
    * LayoutTests/fast/shadow-dom/autofocus-in-shadow-tree.html: Added.
    * LayoutTests/imported/w3c/web-platform-tests/css/selectors/focus-visible-020.html: Merge the test fix
    posted in web-platform-tests/wpt#35257.
    * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-autofocus-expected.txt: Rebaselined.
    * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/focus/focus-method-delegatesFocus-expected.txt: Ditto.

    * Source/WebCore/dom/Element.cpp:
    (WebCore::shouldAutofocus): Fixed the bug that this wasn't ignoring elements inside shadow trees.
    Autofocus attribute yields autofocus candidates if the relevant element is **inserted** into a document,
    not connected to it. See https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute

    (WebCore::autoFocusDelegate): Added. This implements autofocus delegation mechanism for shadow root/host.

    (WebCore::focusDelegateFromShadowHost): Renamed from findFirstProgramaticallyFocusableElementInComposedTree
    and made it recursively traverse shadow trees instead of the composed/flat tree.

    (WebCore::Element::focus):

    Canonical link: https://commits.webkit.org/252901@main

Canonical link: https://commits.webkit.org/252432.292@safari-7614-branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants