Bug 208835 - Safari doesn't preserve user selection upon updating input value with the same value programmatically
Summary: Safari doesn't preserve user selection upon updating input value with the sam...
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 13
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2020-03-09 15:03 PDT by Viacheslav Moskalenko
Modified: 2022-12-16 16:10 PST (History)
6 users (show)

See Also:


Attachments
Demonstrating the issue in Safari (919.97 KB, video/quicktime)
2020-03-09 15:03 PDT, Viacheslav Moskalenko
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Viacheslav Moskalenko 2020-03-09 15:03:33 PDT
Created attachment 393078 [details]
Demonstrating the issue in Safari

Details:
* an input field has some value (say "initial value")
* a user clicks somewhere in the middle of the input field (say, right after "l")
* the input field's value is getting updated programmatically with the same value after n seconds

Expected:
The user's selection (cursor position) doesn't change.

Actual:
A cursor jumps to the end of the input's value (right after "e").

Demo:
https://jsbin.com/pipefoluha/1/edit?html,js,output

Notes:
The cursor positions is correctly handled in:
* Chrome [80.0.3987.132 (Official Build) (64-bit), macOS 10.15.3 (19D76)]
* Firefox [73.0.1 (64-bit), macOS 10.15.3 (19D76)]
Comment 1 Radar WebKit Bug Importer 2020-03-09 15:07:48 PDT
<rdar://problem/60244975>
Comment 2 Ahmad Saleem 2022-12-16 03:37:13 PST
I am not able to reproduce the jump issue in Safari 16.2 and Safari Technology Preview 160 but the field does not get focus like Chrome Canary 110 and Firefox Nightly 110 while showing the caret at "iIn" (I as Caret) position, which might be separate issue.

Can someone else confirm and we mark this bug appropriately while using this test case for other bug tracking purpose? Thanks!
Comment 3 Ryosuke Niwa 2022-12-16 16:10:23 PST
Doesn't reproduce anymore.