Skip to content

Expand disabled form control event handling spec text#12219

Open
hjanuschka wants to merge 3 commits intowhatwg:mainfrom
hjanuschka:disabled-form-control-events
Open

Expand disabled form control event handling spec text#12219
hjanuschka wants to merge 3 commits intowhatwg:mainfrom
hjanuschka:disabled-form-control-events

Conversation

@hjanuschka
Copy link

@hjanuschka hjanuschka commented Mar 1, 2026

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 )
/webappapis.html ( diff )

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
@hjanuschka hjanuschka force-pushed the disabled-form-control-events branch from 1f34452 to aa0143d Compare March 1, 2026 21:57
@annevk
Copy link
Member

annevk commented Mar 2, 2026

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
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
Copy link
Contributor

@josepharhar josepharhar left a comment

Choose a reason for hiding this comment

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

Thanks for starting this!

@hjanuschka hjanuschka requested a review from josepharhar March 4, 2026 01:21
@josepharhar
Copy link
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.

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.

3 participants