Skip to content

Unfocusing steps should account for delegatesFocus somehow #7070

Closed

Description

@emilio

Calling blur() on a shadow host with delegatesFocus = true should blur content inside the shadow tree. This matches sanity (blur() should undo what focus() does) and both WebKit and Blink.

However per spec this shouldn't happen. blur() executes https://html.spec.whatwg.org/#unfocusing-steps, but if you call that on a shadow host with delegatesFocus you bail out here:

If old focus target is not one of the entries in old chain, then return.

Unless I'm missing something, since neither https://html.spec.whatwg.org/#current-focus-chain-of-a-top-level-browsing-context or https://html.spec.whatwg.org/#focus-chain deal with delegatesFocus in any way (and I don't think they should, probably).

See https://bugzilla.mozilla.org/show_bug.cgi?id=1730566 for a test-case.

Activity

  1. domenic commented on Sep 14, 2021

    @domenic
    Member

    Makes sense. Are you able to figure out a rough spec patch that would fix this? Either as a PR, or just writing it up informally here and I can translate it, would be great.

  2. added
    topic: focus
    topic: shadow
    on Sep 14, 2021
  3. emilio commented on Sep 15, 2021

    @emilio
    ContributorAuthor

    @domenic I think around step 2 we should say something like "if old focus target is a shadow host, and its shadow root delegates focus, and the currently focused area of a top-level browsing context is a shadow-including descendant of the shadow root, then let old focus target be the currently focused area of a top-level browsing context."

    Or something like that.

  4. domenic commented on Sep 16, 2021

    @domenic
    Member

    Sounds good. My tentative guess it it should be the very first step, right? Since we probably want to do inert checking/area stuff on the "computed" old focus target, not the original.

    I'll send a PR shortly.

  5. added a commit that references this issue on Sep 16, 2021
    2919d60
  6. added a commit that references this issue on Oct 28, 2021
    8615199
  7. added a commit that references this issue on Nov 1, 2021
    9ba7124
  8. added a commit that references this issue on Dec 4, 2021
    302559e
  9. added a commit that references this issue on Jun 3, 2022
    5524251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: focustopic: shadow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions