WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
290396
Form controls inside a declarative shadow DOM erroneously get associated with form element in an outer tree
https://bugs.webkit.org/show_bug.cgi?id=290396
Summary
Form controls inside a declarative shadow DOM erroneously get associated with...
Konnor Rogers
Reported
2025-03-25 10:05:46 PDT
## Explanation In Desktop Safari 17.5 and 18.3.1 and iOS Safari 18.3.2 (only tested versions so far) a form control rendered inside a declarative shadow DOM leak into the host element's form. This does not happen in Firefox 136 or Chrome 134. Essentially when you have the following: <form> <x-element> <template shadowrootmode="open"> <input name="foo" value="bar"> </template> </x-element> </form> the FormData you will get the following: formData.getAll("foo") // => ["bar"] only in Safari. In Firefox and Chrome you will get an empty array. In addition, doing `form.elements` returns form controls from the shadow dom in Safari. This does not happen when the shadow dom is client side rendered *only* when its rendered via Declarative Shadow DOM. This feels like unintended and unexpected behavior.
https://codepen.io/paramagicdev/pen/gbOjxJy
^ reproduction
Attachments
Reduction
(224 bytes, text/html)
2025-03-25 18:50 PDT
,
Ryosuke Niwa
no flags
Details
More test cases
(758 bytes, text/html)
2025-03-25 19:15 PDT
,
Ryosuke Niwa
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2025-03-25 18:50:50 PDT
Created
attachment 474714
[details]
Reduction
Ryosuke Niwa
Comment 2
2025-03-25 19:15:39 PDT
Created
attachment 474715
[details]
More test cases
Ryosuke Niwa
Comment 3
2025-03-25 23:55:58 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/43034
Konnor Rogers
Comment 4
2025-03-26 00:32:26 PDT
As an additional note, the same mechanism seems to affect button submissions as well:
https://codepen.io/paramagicdev/pen/bNGjmZg
buttons clicked inside a declarative shadow dom cause a form in an outer tree to submit.
EWS
Comment 5
2025-03-26 08:20:15 PDT
Committed
292703@main
(e657338dfd41): <
https://commits.webkit.org/292703@main
> Reviewed commits have been landed. Closing PR #43034 and removing active labels.
Radar WebKit Bug Importer
Comment 6
2025-03-26 08:21:15 PDT
<
rdar://problem/147932589
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug