Bug 186347 - Empty selection with readonly contenteditable element
Summary: Empty selection with readonly contenteditable element
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 11
Hardware: iPhone / iPad iOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-06 05:50 PDT by Jacek Bogdański
Modified: 2018-08-04 22:41 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacek Bogdański 2018-06-06 05:50:00 PDT
Hello,

we struggle with an issue with document.getSelection() function when selected text is inside element with contenteditable=false attribute. Returned selection doesn't contain information about selected text. As a result, you cannot, for example, copy current selection using document.execCommand('copy') function.

Steps to reproduce:

1. Visit https://codepen.io/jacekbogdanski/pen/wXMORq using iPad.
2. Use Safari developer tools with iPad.
3. Select some text from Lorem Ipsum example using iPad.
4. Click `Execute` link.

Expected:

Selection object should contain information about currently selected text.

Actual:

Selection object doesn't contain information about current selection.

Other:

It seems like this issue occurs only with contenteditable elements. It works fine with simple div element or contenteditable=true.
Comment 1 Radar WebKit Bug Importer 2018-08-04 22:41:05 PDT
<rdar://problem/42941462>