Files
Eldar Pulatov 863dc5e9f8 Bug 2068506 [wpt PR 62339] - Preserve selection when input type changes between text and password, a=testonly
Automatic update from web-platform-tests
Preserve selection when input type changes between text and password

When a click handler changes a focused input between text and password,
Blink recreates its UA shadow tree, including its inner editor element.
This can collapse the live DOM selection to offset 0 while the correct
selection remains cached for restoration after layout. The remaining
mouse-release handling calls SelectionChanged(), which replaces the
cache with the collapsed selection because the input is still focused.

With PreserveUnfocusedSelectionCache enabled, use
ShouldApplySelectionCache() instead of focus alone to decide whether
SelectionChanged() may refresh the cache. This keeps the cached
selection intact while a post-layout restore is pending. Preserve the
old behavior when the runtime feature is disabled.

Add WPT coverage for text-to-password and password-to-text changes.
Extend the moveBefore() test to check that the same post-layout
restoration mechanism preserves a focused input's backward selection.

Update the release window for the PreserveUnfocusedSelectionCache: say
that the killswitch ships in M154 and can be removed in M156.

Bug: 40807608
Change-Id: I3c257ddfc28198771da14e8a07fefa892da1b9d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8287984
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1689298}

--

wpt-commits: b22e473a8ccfeb95fdc848f17d237fd44197ff04
wpt-pr: 62339
2026-09-08 11:47:26 +00:00
..