RESOLVED FIXED60376
selectstart event does not fire when selection is made via select all
https://bugs.webkit.org/show_bug.cgi?id=60376
Summary selectstart event does not fire when selection is made via select all
Tim Down
Reported 2011-05-06 09:42:26 PDT
Created attachment 92590 [details] Test case The selectstart event fires (many times) when making a mouse selection or a keyboard selection but does not fire at all when the selection changes using "Select all" options from context/edit menus or via Ctrl/Cmd-A keyboard shortcut.
Attachments
Test case (278 bytes, text/html)
2011-05-06 09:42 PDT, Tim Down
no flags
fixes the bug (6.11 KB, patch)
2011-05-06 19:54 PDT, Ryosuke Niwa
no flags
patch with tests (11.72 KB, patch)
2011-05-06 19:58 PDT, Ryosuke Niwa
no flags
Fixed per comments (11.37 KB, patch)
2011-05-07 23:52 PDT, Ryosuke Niwa
tkent: review+
Alexey Proskuryakov
Comment 1 2011-05-06 17:19:48 PDT
Does it fire in IE?
Tim Down
Comment 2 2011-05-06 17:30:45 PDT
Yes, it fires in IE.
Ryosuke Niwa
Comment 3 2011-05-06 17:31:02 PDT
(In reply to comment #1) > Does it fire in IE? IE9 doesn't.
Tim Down
Comment 4 2011-05-06 17:34:56 PDT
I only have Win XP at home so I can't test IE 9. It fires in IE 6 and 7. My test case isn't great: in IE you need to make sure you've got the focus on the body (eg by clicking on the text) before doing the select all.
Alexey Proskuryakov
Comment 5 2011-05-06 17:40:50 PDT
If you need this to prevent selection, please note that WebKit supports a better way to do that (that is, -webkit-user-select CSS property).
Tim Down
Comment 6 2011-05-06 17:43:16 PDT
Nothing to do with preventing selection. I do quite a bit of work with contenteditable/designMode and I'm interested in being notified whenever the selection is modified by any means: mouse, keyboard, menu option.
Ryosuke Niwa
Comment 7 2011-05-06 17:46:55 PDT
(In reply to comment #6) > Nothing to do with preventing selection. I do quite a bit of work with contenteditable/designMode and I'm interested in being notified whenever the selection is modified by any means: mouse, keyboard, menu option. Does selectionchange work for your use case? Since IE9 no longer fires selectstart when selecting all, I'm not sure we should change WebKit's behavior here.
Ryosuke Niwa
Comment 8 2011-05-06 17:48:27 PDT
(In reply to comment #4) > in IE you need to make sure you've got the focus on the body (eg by clicking on the text) before doing the select all. Ah, thanks for pointing that out. Now IE9 fires selectstart as well.
Tim Down
Comment 9 2011-05-06 17:51:01 PDT
Frankly I don't care which event fires so long as one does, so selectionchange is fine by me. I assume this change is recent enough that I'll need to test against a nightly?
Ryosuke Niwa
Comment 10 2011-05-06 18:03:13 PDT
Now that I know IE9 also fires we should definitely fix this bug. (In reply to comment #9) > Frankly I don't care which event fires so long as one does, so selectionchange is fine by me. I assume this change is recent enough that I'll need to test against a nightly? It's shipped in Chrome 11.
Ryosuke Niwa
Comment 11 2011-05-06 19:54:43 PDT
Created attachment 92681 [details] fixes the bug
Ryosuke Niwa
Comment 12 2011-05-06 19:58:32 PDT
Created attachment 92682 [details] patch with tests
Kent Tamura
Comment 13 2011-05-07 20:46:28 PDT
Comment on attachment 92682 [details] patch with tests View in context: https://bugs.webkit.org/attachment.cgi?id=92682&action=review > LayoutTests/fast/events/selectstart-on-selectall.html:13 > +var selectstartEvent = null; This variable is not used. > Source/WebCore/editing/FrameSelection.cpp:1403 > + selectElement->selectAll(); Need "return" after this line?
Ryosuke Niwa
Comment 14 2011-05-07 23:52:02 PDT
Created attachment 92732 [details] Fixed per comments
Ryosuke Niwa
Comment 15 2011-05-07 23:52:54 PDT
(In reply to comment #13) > (From update of attachment 92682 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=92682&action=review > > > LayoutTests/fast/events/selectstart-on-selectall.html:13 > > +var selectstartEvent = null; > > This variable is not used. Removed. > > Source/WebCore/editing/FrameSelection.cpp:1403 > > + selectElement->selectAll(); > > Need "return" after this line? Oops, a good catch!
Kent Tamura
Comment 16 2011-05-08 17:43:08 PDT
Comment on attachment 92732 [details] Fixed per comments Looks good.
Ryosuke Niwa
Comment 17 2011-05-08 19:15:26 PDT
(In reply to comment #16) > (From update of attachment 92732 [details]) > Looks good. Thanks for the review!
Ryosuke Niwa
Comment 18 2011-05-08 20:29:48 PDT
WebKit Review Bot
Comment 19 2011-05-09 03:41:08 PDT
http://trac.webkit.org/changeset/86041 might have broken Leopard Intel Debug (Tests) The following tests are not passing: fast/workers/storage/use-same-database-in-page-and-workers.html http/tests/appcache/fail-on-update-2.html http/tests/appcache/fail-on-update.html http/tests/misc/favicon-loads-with-icon-loading-override.html storage/domstorage/localstorage/storagetracker/storage-tracker-2-create.html storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all.html svg/animations/animate-path-nested-transforms.html
Note You need to log in before you can comment on or make changes to this bug.