Bug 16976 - caret position needs to be set *before* firing/handling input events
Summary: caret position needs to be set *before* firing/handling input events
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-01-22 11:51 PST by Tim S
Modified: 2022-07-30 13:18 PDT (History)
8 users (show)

See Also:


Attachments
test that caret selection is set before firing input event (1.10 KB, text/html)
2008-01-22 11:55 PST, Tim S
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim S 2008-01-22 11:51:28 PST
Editor::appliedEditing currently dispatches input events and after sets the selection (caret) to the end of the text. This means when handling an input event, you cannot modify the selection without being 'trumped' by this later setting by appliedEditing. 

I tried making a patch to fix this by simply moving one line in this method, dispatchEditibleContentChangedEvents, 5 lines down so it occurs after the call to setSelection. I created a layout test to verify (see attached). However, the patch causes two layout tests to fail: fast/forms/drag-into-textarea.html and fast/forms/drag-out-of-textarea.html. The output differs in these two tests because rather than cut/pasting, the drag an drop results in both fields being empty or both fields containing the text, respectively. The expected output is correct and I don't think it should be changed, so this attempt to fix breaks text drag and drop, but I'm not sure why.
Comment 1 Tim S 2008-01-22 11:55:45 PST
Created attachment 18602 [details]
test that caret selection is set before firing input event

currently fails on recent c.o @ r29678
Comment 2 Eric Seidel (no email) 2008-01-22 12:30:23 PST
The test passes in FF and Opera, and does not actually execute cleanly in IE.
Comment 3 Adam Roben (:aroben) 2008-02-26 15:05:23 PST
<rdar://problem/5766949>
Comment 4 Ahmad Saleem 2022-07-30 09:45:00 PDT
I am unable to reproduce this bug in Safari 15.6 on macOS 12.5 using attached test case and as soon as I type something in <input> field, I get "test passed" and it is same across all other browsers (Firefox Nightly 105 and Chrome Canary 106). I think it got fixed along the way and this can be marked as "RESOLVED CONFIGURATION CHANGED". Thanks!