WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
198603
select all in contenteditable selects only text content
https://bugs.webkit.org/show_bug.cgi?id=198603
Summary
select all in contenteditable selects only text content
k.litwinowicz
Reported
2019-06-06 01:21:52 PDT
Created
attachment 371479
[details]
Html to reproduce the issue Steps to reproduce the problem: 1. Create and open html file with following content, or use attached one: `<div class="editor" contenteditable="true"><div>foo</div></div>` 2. Focus editable div. 3. Select all, you can either use keystroke, contextmenu or call `document.execCommand( 'selectall' )`. 4. Inspect selection ranges in console: `document.getSelection().getRangeAt( 0 )` What is the expected behavior? According to
https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
> selectAll > Selects all of the content of the editable region.
Range start/end container is div#editable startOffset = 0; endOffset = 1; `<div class="editor" contenteditable="true">[<div>foo</div>]</div>` What went wrong? Range start/end container is text node inside nested div startOffset = 0 endOffset = 1 `<div class="editor" contenteditable="true"><div>{foo}</div></div>` This is troublesome for users of rich text editors, as copied data doesn't match to all content of an editable. Edge and Firefox works as expected. Same issue in Chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=931285
Attachments
Html to reproduce the issue
(182 bytes, text/html)
2019-06-06 01:21 PDT
,
k.litwinowicz
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-06-06 09:33:05 PDT
<
rdar://problem/51486602
>
Ryosuke Niwa
Comment 2
2019-06-06 13:50:24 PDT
***
Bug 34377
has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 3
2019-06-06 13:51:08 PDT
This stems from the fact WebKit always canonicalizes the selection end points before doing any editing operations. The
bug 15256
is also caused by this behavior.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug