NEW 93760
Selection change caused by click event on button should be *after* the onclick fires
https://bugs.webkit.org/show_bug.cgi?id=93760
Summary Selection change caused by click event on button should be *after* the onclic...
David Gatwood
Reported 2012-08-10 21:08:08 PDT
Created attachment 157856 [details] Demonstrates odd behavior of buttons inside contentEditable regions I would normally expect a button's onclick handler to fire prior to any in-browser modification of the current DOM selection. For some odd reason, in WebKit, the reverse occurs—the selection changes first—leading to spectacular misbehavior if you're crazy enough to place a button inside a contentEditable region. :-) Test case attached. The expected behavior is that when you click inside the text above, then click the button, the click event should fire first, causing the content to be inserted at the selection point. Instead, the insertion point moves first, so that the insertion point is inside the text of the button. Thus, the content gets inserted inside the button.
Attachments
Demonstrates odd behavior of buttons inside contentEditable regions (613 bytes, text/html)
2012-08-10 21:08 PDT, David Gatwood
no flags
Alexey Proskuryakov
Comment 1 2012-08-13 09:56:57 PDT
See also: bug 93674. Perhaps we match IE here, as well?
Ryosuke Niwa
Comment 2 2012-08-13 14:53:45 PDT
IE doesn't change the selection until click event either.
Ahmad Saleem
Comment 3 2022-07-26 15:05:25 PDT
I am able to reproduce this bug using attached test case in Safari 15.6 on macOS 12.5 where placing caret on the text and then pressing button trigger dialog with "fail" rather than adding text. It is same with Chrome Canary 106 and only Firefox Nightly 104 is where it add text and does not show any "fail" dialog. Thanks!
Radar WebKit Bug Importer
Comment 4 2022-07-26 19:40:16 PDT
Ryosuke Niwa
Comment 5 2022-07-26 22:50:13 PDT
Blink and WebKit still fail the attached test case.
Note You need to log in before you can comment on or make changes to this bug.