# 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.
<rdar://problem/87873363>
This seems to work on iOS 16.4.