← Back to release summary

Update text selection on mouseup before dispatching click event

Category
User input
Type
No developer-visible change
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Currently Chromium applies the default action of a mouseup event (e.g. collapsing or committing a drag-selection in a text input) after the click event has already been dispatched. This violates developer expectations: a click handler that reads selection state sees stale data from before the mouseup default action ran. This change moves the mouseup default-action step to run before the click event is dispatched, so that selection (and any other mouseup side effects) is already settled when click handlers execute.

Motivation

In Chromium, the mouseup default action (e.g. committing a drag-selection) fires after the click event. As a result, click handlers that read window.getSelection() or input.selectionStart/End see stale selection state and must work around this with setTimeout or a separate selectionchange listener.

Standards & signals

View on chromestatus.com