[Webkit-unassigned] [Bug 218890] New: [iOS 14] window.getSelection().getRangeAt(0) on iOS 14 WKWebView not return startOffset as other browsers and iOS 13 WKWebView
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 13 01:08:41 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=218890
Bug ID: 218890
Summary: [iOS 14] window.getSelection().getRangeAt(0) on iOS 14
WKWebView not return startOffset as other browsers and
iOS 13 WKWebView
Product: WebKit
Version: Safari 14
Hardware: iPhone / iPad
OS: Other
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: xiehaiyan_xhy at sina.com
In iOS 13 WKWebview and other browsers such as Chrome, when call window.getSelection().getRangeAt(0), it will return the tap character index.
But on iOS 14 WKWebview, window.getSelection().getRangeAt(0) doesn't return character index, but seems to return a word end index in en language.
My question is:
Can we fix this to keep the same as other browsers and iOS 13 WKWebView?
Details as below:
Code:
document.addEventListener('click', (event) => {
var range = window.getSelection().getRangeAt(0);
console.log("startOffset: "+ range.startOffset.toString());
});
Test case 1:
Action: There is a sentence in website as "Test click on website", click at the end of "e" in "Test".
Output:
In iOS 13 WKWebview and other browsers: startOffset: 2
In iOS 14 WKWebview: startOffset: 5
Also in iOS 14 WKWebview the word ending rule is not the same, when click on the first word in the node, return index will include whitespace, as we see in test case 1.
But some others return index which not include whitespace as Test case 2.
Test case 2:
There is a sentence in website as "Test click on website", tap at the end of "l" in "click"
Output:
In iOS 13 WKWebview and other browsers: startOffset: 7
In iOS 14 WKWebview: startOffset: 10
--
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/20201113/cb90a390/attachment.htm>
More information about the webkit-unassigned
mailing list