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.
chrome://flags/#enable-experimental-web-platform-features. Expected to ship without a flag in a later milestone.
at a glance
| Status in 150 | In developer trial (behind a flag) |
|---|---|
| Flag | chrome://flags/#enable-experimental-web-platform-features |
| Standards position | Firefox: N/A (already correct) · Safari: N/A (already correct) |
| ChromeStatus | 5298387739082752 — 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.
event order (fixed)
| Step | Before Chrome 150 | Chrome 150+ |
|---|---|---|
| 1 | mousedown — selection starts | mousedown — selection starts |
| 2 | mousemove — selection extends | mousemove — selection extends |
| 3 | mouseup fires | mouseup fires |
| 4 | click fires ← selection not yet updated | selection committed to DOM |
| 5 | selection committed to DOM | click fires — sees correct selection |
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
| Chrome | 150 — developer trial; correct order behind flag |
|---|---|
| Firefox | Already correct |
| Safari | Already correct |