← Chrome 150 reference

v150 · dom events · developer trial

Update text selection on mouseup before dispatching click event

Chrome 150 fixes the order of operations for text-selection updates and click events: the selection is now committed to the DOM before the click event fires, so that click handlers see the correct, final selection state — matching the behaviour of Firefox and Safari.

Developer trial / behind a flag In developer trial in Chrome 150. Enable via chrome://flags/#enable-experimental-web-platform-features. Expected to ship without a flag in a later milestone.

at a glance

Status in 150In developer trial (behind a flag)
Flagchrome://flags/#enable-experimental-web-platform-features
Standards positionFirefox: N/A (already correct)  ·  Safari: N/A (already correct)
ChromeStatus5298387739082752 — Update text selection on mouseup before dispatching click event

what was wrong

In Chrome before this fix, when a user clicked inside a text input or a contenteditable element to end a drag-selection, Chrome applied the "commit selection" action (collapsing or anchoring the drag selection) after the click event had already fired. This meant that a click handler that called document.getSelection() or read input.selectionStart / input.selectionEnd would see the old selection state — the one from before the mouse was released — rather than the final committed selection.

Firefox and Safari always update selection before dispatching click. This fix brings Chrome into alignment.

Source: chromestatus summary.

event order (fixed)

StepBefore Chrome 150Chrome 150+
1mousedown — selection startsmousedown — selection starts
2mousemove — selection extendsmousemove — selection extends
3mouseup firesmouseup fires
4click fires ← selection not yet updatedselection committed to DOM
5selection committed to DOMclick fires — sees correct selection
Source: chromestatus summary.

impact on code

If you read the selection in a click handler, you'll now see the correct final state:

input.addEventListener("click", () => {
  // Before Chrome 150: might show old selection from mid-drag
  // Chrome 150+: always shows final committed selection
  console.log(input.selectionStart, input.selectionEnd);
  console.log(document.getSelection().toString());
});

This is a correctness fix — code that was already reading selection state on click will work more reliably. However, if you had workarounds (e.g. reading selection inside a setTimeout(..., 0) to defer past the old commit), those workarounds are no longer necessary and can be removed.

browser support

Chrome150 — developer trial; correct order behind flag
FirefoxAlready correct
SafariAlready correct
Source: chromestatus browser views.

see also