Bug 220522 - getSelection().focusNode in iOS is not pointing to the correct node
Summary: getSelection().focusNode in iOS is not pointing to the correct node
Status: RESOLVED DUPLICATE of bug 220523
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: iPhone / iPad iOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-11 12:05 PST by Kyle
Modified: 2021-01-11 16:50 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle 2021-01-11 12:05:54 PST
document.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.
Comment 1 Alexey Proskuryakov 2021-01-11 16:50:40 PST

*** This bug has been marked as a duplicate of bug 220523 ***