Bug 240011 - Double tap to hold on a Canvas tag to selected other text
Summary: Double tap to hold on a Canvas tag to selected other text
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-03 07:51 PDT by misinoe.t
Modified: 2022-05-10 07:52 PDT (History)
5 users (show)

See Also:


Attachments
This is a working demo and recorded video (451.29 KB, application/zip)
2022-05-03 07:51 PDT, misinoe.t
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description misinoe.t 2022-05-03 07:51:16 PDT
Created attachment 458744 [details]
This is a working demo and recorded video

I have confirmed that the paint web application I developed does not work properly on my iPad Pro.

Pursuing deeper, I found that
When I double tap and hold on an HTMLCanvasElement, nearby text is selected.

This causes the focus to be incorrect and the position of the magnifier to be fixed to the top of the selected text.
Comment 1 Wenson Hsieh 2022-05-03 18:22:53 PDT
Able to reproduce on trunk WebKit, iOS 15. The `canvas` element already has `user-select: none;`, but that doesn't seem to have any effect :(

(Using `-webkit-user-select: none;` didn't make any difference either).
Comment 2 Wenson Hsieh 2022-05-03 18:32:12 PDT
I think we can fix this by relaxing this check:

```
(in WKContentViewInteraction.mm:)

    if (gesture == UIWKGestureLoupe && _positionInformation.selectability == WebKit::InteractionInformationAtPosition::Selectability::UnselectableDueToUserSelectNone)
        return NO;

```

...to something like this instead:

```
(in WKContentViewInteraction.mm:)

    if (gesture != UIWKGestureOneFingerTap && _positionInformation.selectability == WebKit::InteractionInformationAtPosition::Selectability::UnselectableDueToUserSelectNone)
        return NO;

```

I _suspect_ the choice to limit this to only the Loupe gesture was made to (1) limit risk, and (2) to make it so that the user can always still tap in `-webkit-user-select: none;` regions to clear an existing selection.

One workaround here would be to add active touch event listeners and prevent `touchstart` and/or `touchend`.
Comment 3 Radar WebKit Bug Importer 2022-05-10 07:52:15 PDT
<rdar://problem/93028767>