[Webkit-unassigned] [Bug 198603] New: select all in contenteditable selects only text content

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 6 01:21:52 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198603

            Bug ID: 198603
           Summary: select all in contenteditable selects only text
                    content
           Product: WebKit
           Version: Safari 12
          Hardware: Macintosh
                OS: macOS 10.14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Editing
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: k.litwinowicz at cksource.com
                CC: wenson_hsieh at apple.com

Created attachment 371479

  --> https://bugs.webkit.org/attachment.cgi?id=371479&action=review

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190606/cf2366b0/attachment.html>


More information about the webkit-unassigned mailing list