Bug 314344

Summary: Add support for readonly in fieldset
Product: WebKit Reporter: teo.eterovic
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

teo.eterovic
Reported 2026-05-07 14:03:09 PDT
I've opened a draft PR for: https://github.com/whatwg/html/issues/10293 (see last comment for details) and PR: https://github.com/whatwg/html/pull/12424 The approach mirrors disabled: a readonly attribute on <fieldset> propagates read-only state to descendant <input> (in states where readonly is meaningful), <textarea>, and form-associated custom elements. Controls like checkbox, radio, button, and <select> are unaffected. Anything inside the first <legend> child is excluded. A formReadonlyCallback is introduced on form-associated custom elements parallel to formDisabledCallback. This would create behavior consistent with the disabled attribute, but the real benefit would be to use it for web components that have form association implemented to be handled through a form manager - for example dynamic forms / form builder.
Attachments
teo.eterovic
Comment 1 2026-05-07 14:43:45 PDT
**Spec issue:** https://github.com/whatwg/html/issues/10293 **Spec PR:** https://github.com/whatwg/html/pull/12424 **WPT tests (tentative):** https://github.com/web-platform-tests/wpt/pull/59741 ## Summary Add a `readonly` content attribute to `<fieldset>` that propagates a read-only state to descendant form controls that support being readonly, mirroring the existing `disabled` attribute on `<fieldset>`. ## Behavior - The attribute is reflected as `HTMLFieldSetElement.readOnly` - Affected descendants: - `<input>` in states that support readonly (text, search, url, tel, email, password, date, month, week, time, datetime-local, number) - `<textarea>` - Form-associated custom elements, via a new `formReadonlyCallback` - Unaffected: checkbox, radio, file, button/submit/reset/image, range, color, hidden, `<button>`, `<select>` - Descendants of the first `<legend>` element child are exempt (matching the `disabled` exemption) - Nested fieldsets propagate; the legend exemption applies per fieldset and does not extend to legends of nested fieldsets ## Why Authors today have to manually toggle `readonly` on every form control inside a section. `<fieldset disabled>` already provides bulk disabling; read-only state — which is semantically distinct (values still submit, focus and selection still work) — has no equivalent. This is also very useful for web components - Form-Associated Components attachInternals ## Tests WPT tests are landed as `.tentative` at `html/semantics/forms/the-fieldset-element/readonly-*.tentative.html`. They will turn green once this is implemented. ## Asking for Implementer signal on the WHATWG PR checklist — please leave a comment on https://github.com/whatwg/html/pull/12424 indicating interest (or concerns), and link this bug.
Note You need to log in before you can comment on or make changes to this bug.