Skip to content

Expand disabled form control event handling spec text - #12219

Open
hjanuschka wants to merge 5 commits into
whatwg:mainfrom
hjanuschka:disabled-form-control-events
Open

Expand disabled form control event handling spec text#12219
hjanuschka wants to merge 5 commits into
whatwg:mainfrom
hjanuschka:disabled-form-control-events

Conversation

@hjanuschka

@hjanuschka hjanuschka commented Mar 1, 2026

Copy link
Copy Markdown

The current spec text for disabled form controls says only:

A form control that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on the element.

This is incomplete. This PR expands it to describe:

  • Full event list: click, mousedown, mouseup, and dblclick are all prevented on disabled form controls (not just click)
  • Event path truncation: When these events target a descendant of a disabled form control, the disabled control and all its ancestors are removed from the event path - the event fires on the descendant but does not bubble through the disabled control
  • Pointer events unaffected: A note clarifying that pointerdown, pointerup, etc. are dispatched normally

All three major engines have shipped this behavior.

Chrome - shipped M120 (Nov 2023)

  • bf57b47 - "Stop click/mouseup/mousedown propagation at disabled form parents"
  • 5a770f4 - Enabled by default (Jun 2023)
  • cd94a8c - Flag removed, behavior permanent (Nov 2023)

Safari - shipped Safari 17 (Sep 2023)

Firefox - shipped Firefox 124 (Jan 2024)

  • Bug 1653882 - main tracking bug
  • Bug 1799565 - "Allow pointer events on disabled form elements on Nightly"
  • Bug 1829874 - "Disabled fieldset should not stop event propagation"
  • 87db82da5ead - dom.forms.always_allow_pointer_events.enabled shipped by default (Jan 2024)

WPT tests

The following WPT tests already verify this behavior but are marked .tentative pending this spec change:

  • html/semantics/disabled-elements/disabled-event-dispatch.tentative.html
  • html/semantics/disabled-elements/event-propagate-disabled.tentative.html
  • html/semantics/disabled-elements/disabled-event-dispatch-additional.tentative.html
  • html/semantics/disabled-elements/fieldset-event-propagation.tentative.html

Once this lands, these can be renamed to remove .tentative.

Closes


/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )

@hjanuschka
hjanuschka force-pushed the disabled-form-control-events branch from 1f34452 to aa0143d Compare March 1, 2026 21:57
@annevk

annevk commented Mar 2, 2026

Copy link
Copy Markdown
Member

This looks reasonable, but eventually this kind of requirement should really live in UI Events (perhaps with some kind delegation to let HTML decide what elements it applies to) or whatever specification ends up defining the algorithm that will eventually call DOM's dispatch for these events.

@hjanuschka

Copy link
Copy Markdown
Author

@annevk thanks, pushed update.

@hjanuschka
hjanuschka marked this pull request as ready for review March 2, 2026 09:06
@annevk
annevk requested a review from smaug---- March 2, 2026 16:53

@josepharhar josepharhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting this!

Comment thread source Outdated
Comment thread source Outdated
@hjanuschka
hjanuschka requested a review from josepharhar March 4, 2026 01:21
@josepharhar

Copy link
Copy Markdown
Contributor

Thanks, I think the new paragraph explains the nuance. However, I wonder if it would be better to implement this directly in the event dispatching algorithms in the dom spec - if I were interested in reading the spec about this behavior, I probably wouldn't come across this area about the user interaction task source since it doesn't seem very related.

The implementation in chromium is basically just this: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/events/mouse_event.cc;l=398-402;drc=75a48e0642c9e236aeebac88e338741f7a4a39ab

I don't see anything about event paths in the UIEvents spec.

@hjanuschka

Copy link
Copy Markdown
Author

moved the normative requirements out of the user interaction task source and into the disabled option/form-control sections for discoverability, should i do a dom/ui PR too?

@josepharhar

Copy link
Copy Markdown
Contributor

I guess if the logic really exists in uievents instead of any of the whatwg specs like anne was saying, then maybe changing whatwg/dom won't be necessary.

This change certainly does make things better though, so lgtm

@hjanuschka

Copy link
Copy Markdown
Author

@smaug---- any chances you can take a look? (not sure whats the process is; to move on)

@hjanuschka

Copy link
Copy Markdown
Author

can we merge this?

@josepharhar

Copy link
Copy Markdown
Contributor

I'd certainly like to see this get merged. I'll add agenda+

@josepharhar josepharhar added the agenda+ To be discussed at a triage meeting label Aug 11, 2026
Comment thread source Outdated
Comment thread source
@smaug---- smaug---- removed the agenda+ To be discussed at a triage meeting label Aug 18, 2026
@smaug----

Copy link
Copy Markdown

I think this doesn't need to be on the agenda, but this needs a new pr. @hjanuschka would you have time to update this?

Expand the spec text for disabled form controls to describe the
complete set of events affected (click, mousedown, mouseup, dblclick)
and the event path truncation behavior that prevents these events
from bubbling through disabled form controls to ancestor elements.

Add a note clarifying that pointer events are unaffected.

This matches the behavior shipped in Chrome M120 (Nov 2023) via
EventPath::AdjustForDisabledFormControl(), and aligns with
Firefox's direction.

The following WPT tests already verify this behavior but are marked
.tentative pending this spec change:
- html/semantics/disabled-elements/disabled-event-dispatch.tentative.html
- html/semantics/disabled-elements/event-propagate-disabled.tentative.html
- html/semantics/disabled-elements/disabled-event-dispatch-additional.tentative.html
- html/semantics/disabled-elements/fieldset-event-propagation.tentative.html

Once this lands, these tests can be renamed to remove the .tentative
suffix.

Closes: whatwg#5886
Closes: whatwg#2368
Fixes: https://issues.chromium.org/issues/41302618
click and dblclick events are never queued on the user interaction
task source; they are dispatched synchronously from the task that
dispatches mouseup. Keying the requirement on the task source would
also wrongly suppress untrusted events fired by script from within
that task. Rephrase both the option element and form control
requirements to apply to events whose isTrusted attribute is true,
matching shipped engine behavior.
@hjanuschka
hjanuschka force-pushed the disabled-form-control-events branch from 2746326 to 236b8aa Compare August 18, 2026 10:59
@hjanuschka

Copy link
Copy Markdown
Author

updated - both paragraphs now keyed on trusted click/mousedown/mouseup/dblclick events, rebased on main. ptal @smaug----

@hjanuschka

Copy link
Copy Markdown
Author

@smaug---- or did you mean to close and new PR?

@smaug----

Copy link
Copy Markdown

I think updating is fine. Thanks.

@hjanuschka

hjanuschka commented Aug 19, 2026

Copy link
Copy Markdown
Author

I think updating is fine. Thanks.

update pushed

@hjanuschka
hjanuschka requested a review from smaug---- August 19, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants