Bug 235223

Summary: REGRESSION(iOS 15): getSelection() is successful rarely, on onclick event
Product: WebKit Reporter: Takao Baba <baba>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: megan_gardner, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   

Description Takao Baba 2022-01-14 01:04:34 PST
# Steps to reproduce:

1. Open https://jsbin.com/pubipidaxu/edit?html,js,output by Safari on iOS 15.
2. Long-press "Hello". Make sure the text is selected.
3. Touch "click" button.

# Expected behavior:

Alert with text "Hello" is shown. (I'm not care whether the selection remains or not.)

# Actual behaviro:

In most cases, alert with no text is shown. Sometimes works correctly.

# Note

On iOS 14, getSelection() can always get the text. The selection seems remain though it become invisible at the click.

Other browsers such as Android Chrome and desktop browsers do not have this issue: the selection remains after the click.
Comment 1 Radar WebKit Bug Importer 2022-01-21 01:05:16 PST
<rdar://problem/87873363>