Spec Change: Disabled Form Control Events

#41302618 Filed 2017-02-17 Code Shipped (M120) Spec Pending

Summary

What happened

Disabled form controls (<button disabled>, <input disabled>, etc.) were swallowing all mouse events in Chrome. The fix shipped permanently in M120 (Nov 2023) after the SendMouseEventsDisabledFormControls flag was removed.

The code is done. What remains is updating the HTML spec to match reality.

Current PR direction (after review feedback)

The requirement is now layered in one PR:

This addresses the layering concern: event dispatch rules live with the algorithm that fires user-input events, not in generic DOM dispatch text.

Shipped Behavior (Chrome M120+)

Event On disabled control Bubbles past disabled control On children of disabled control
click Blocked No (path truncated) Fires
mousedown Blocked No (path truncated) Fires
mouseup Blocked No (path truncated) Fires
dblclick Blocked No (path truncated) Fires
pointerdown Fires Yes (normal) Fires
pointerup Fires Yes (normal) Fires
pointermove Fires Yes (normal) Fires

Proposed Spec Diff

File: source (form-control and event-loop sections in whatwg/html)

@@ Enabling and disabling form controls: the disabled attribute @@ <div w-nodev> - <p>A form control that is disabled must prevent any click events ...</p> + <p class="note">For events fired from the user interaction task source, + disabled form controls suppress dispatch of some trusted mouse events as + defined in the task source integration requirements below.</p> ... (pointer events note remains here) ... @@ Generic task sources - user interaction task source @@ + For trusted click/mousedown/mouseup/dblclick events fired from this task source: + - if target is a disabled form control (or disabled option), do not dispatch on it; + - if target is inside a disabled form control, do not dispatch on that control or ancestors. <!-- user interaction events integration point -->

Rendered: Before vs After

BEFORE (previous draft - all requirement in disabled section):

A form control that is disabled must prevent any click, mousedown, mouseup, and dblclick events that are queued on the user interaction task source from being dispatched on the element or from bubbling past the element to its ancestors.

Note: This does not affect pointer events such as pointerdown and pointerup, which are dispatched normally regardless of the disabled state. Authors who wish to observe user interaction with disabled form controls can use pointer event listeners.
AFTER (current layered draft - same PR):

Section: Enabling and disabling form controls

For events fired from the user interaction task source, disabled form controls suppress dispatch of some trusted mouse events as defined in the task source's integration requirements below.

Note: This does not affect pointer events such as pointerdown and pointerup, which are dispatched normally regardless of the disabled state. Authors who wish to observe user interaction with disabled form controls can use pointer event listeners.

Section: Generic task sources - user interaction task source

Events sent in response to user input (e.g., click events) must be fired using tasks queued with the user interaction task source.

For trusted click, mousedown, mouseup, and dblclick events that are fired from tasks queued with this task source: if the event target is a form control that is disabled, or an option element that is disabled, then the event must not be dispatched on that element; and if the event target is a descendant of a form control that is disabled, then the event must not be dispatched on that form control or any of its ancestors.

Implementation Evidence

Chrome (shipped M120, Nov 2023)

Firefox - shipped Firefox 124 (Jan 2024)

Safari - shipped Safari 17 (Sep 2023)

WPT Tests (all .tentative - pending spec)

Related Links