NEW 220523
getSelection().focusNode in iOS is not pointing to the correct node
https://bugs.webkit.org/show_bug.cgi?id=220523
Summary getSelection().focusNode in iOS is not pointing to the correct node
Kyle
Reported 2021-01-11 12:11:41 PST
window.getSelection().focusNode behavior difference on iOS than it is on Android, MacOS and Windows 10. Minimal example: https://kyle-keating.s3-us-west-1.amazonaws.com/getSelection_issue.html This is a simple html page with two paragraphs. As you make a selection to highlight text (using a mouse or touch device), the value of the focusNode is reported in the input field. Using a webkit browser on the desktop (such as Safari), 1. Highlight text in the first paragraph and drag the selection to the second. Notice the value of the input field changes from the text in the first paraph to the second. 2. Repeat this same test but start from the second paraph and drag and select up to the first. Notice the value of the input field changes from the text in the second paraph to the first. I assume this is the correct behavior. Now, using an iOS device perform the same two tests. The second test fails as the value of focusNode does not change when making a selection from a node lower in the DOM to one higher. I believe this is a bug.
Attachments
html example (1.00 KB, text/html)
2021-01-20 08:03 PST, Kyle
no flags
Alexey Proskuryakov
Comment 1 2021-01-11 16:50:40 PST
*** Bug 220522 has been marked as a duplicate of this bug. ***
Radar WebKit Bug Importer
Comment 2 2021-01-18 12:12:13 PST
Kyle
Comment 3 2021-01-20 08:03:35 PST
Created attachment 417970 [details] html example
Kyle
Comment 4 2021-01-20 08:06:27 PST
Related PR about this issue for additional context https://github.com/hypothesis/client/pull/2849
Smoley
Comment 5 2021-01-20 16:42:28 PST
Thanks for filing, I can reproduce this on shipping iOS 13 as well using the attached test case.
Note You need to log in before you can comment on or make changes to this bug.