[Webkit-unassigned] [Bug 260480] New: Custom element with delegatesFocus does not focus if inner element is not first child

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 21 12:46:24 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=260480

            Bug ID: 260480
           Summary: Custom element with delegatesFocus does not focus if
                    inner element is not first child
           Product: WebKit
           Version: Safari 16
          Hardware: Mac (Apple Silicon)
                OS: macOS 13
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: lizmitchell at google.com

A custom element with `delegatesFocus: true` does not correctly delegate focus if the first child of the custom element's shadow DOM is not focusable.

This is common with wrapper divs and styling.

```
<!-- Does not delegate focus correctly -->
<x-button>
  #shadow-root
    <div class="style">
      <button><slot></slot></button>
    </div>
</x-button>

<!-- Delegates focus correctly -->
<x-button>
  #shadow-root
    <button><slot></slot></button>
</x-button>
```

See https://jsbin.com/ranuvuhiri/edit?html,output and click on "Focus button"

Expected: custom element button is focused
Actual: button is not focused

Tested in Safari 16.6 on MacOS 13.5

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230821/dfb1b15b/attachment.htm>


More information about the webkit-unassigned mailing list