Created attachment 467691 [details] Repro When enabling formAssociated on a custom element, it becomes focusable whereas when formAssociated is false it is not. Chrome and Firefox both do not exhibit this behavior but it does occur in Safari Technology Preview Release 178 (Safari 17.0, WebKit 18617.1.6). When setting formAssociated=false Safari behaves the same as Chrome and Firefox. Attached is a repro showing that calling element.focus() with formAssociated=true causes focus to move to the element, which is demonstrated by document.activeElement below. customElements.define( 'x-foo', class Foo extends HTMLElement { static formAssociated = true; } ); const foo = document.querySelector('x-foo'); foo.focus(); console.log(document.activeElement); Note document.activeElement is <body> in Chrome and Firefox but <x-foo> in Safari. Note that the spec does not imply any kind of focus behavior for formAssociated: https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements
<rdar://problem/115909679>
Pull request: https://github.com/WebKit/WebKit/pull/18487
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/42287
Committed 268756@main (7e0cd07bab81): <https://commits.webkit.org/268756@main> Reviewed commits have been landed. Closing PR #18487 and removing active labels.