Bug 209821 - Changing WKWebView ScrollView’s contentInset results in wiggle while selecting a text inside content editable <div>
Summary: Changing WKWebView ScrollView’s contentInset results in wiggle while selectin...
Status: RESOLVED DUPLICATE of bug 193494
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Critical
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-31 10:44 PDT by Mohan
Modified: 2020-04-01 06:00 PDT (History)
5 users (show)

See Also:


Attachments
Sample iOS Project (35.33 KB, application/zip)
2020-03-31 10:44 PDT, Mohan
no flags Details
Repro video (4.87 MB, video/mp4)
2020-03-31 10:46 PDT, Mohan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mohan 2020-03-31 10:44:29 PDT
Created attachment 395064 [details]
Sample iOS Project

I have UIViewController subclass hosting WKWebView on its view’s entire bounds. Content inset of WKWebView scrollview is set to UIEdgeInsetsMake(200,0,0,0) to accommodate a header view.

WKWebView is loaded with a webpage that contains single content editable div tag.
 
Eg.
<html>
<head>
<body>
<div contenteditable="true">Add content here</div>
</body>
</head>
</html>
 
When I type some text in the editable area and start selecting the text by double tap and selection handle drag WKWebView’s scroll view starts to moves up and down continuously.

Is it okay to change content inset of WKWebView's scroll view ? 

Tried alternate approach below,
I thought its allowed since scrollview content inset is adjusted in other scenraios like safe area insets(eg. content inset of scrollview is adjusted automatically if WebView underlaps UINavigationBar).

I tried by setting ViewController's additionalSafeAreaInsets property to UIEdgeInsetsMake(200.0, self.additionalSafeAreaInsets.left, self.additionalSafeAreaInsets.bottom, self.additionalSafeAreaInsets.right); and the issue is not observed in this scenario but the only problem is scrollview ignores any interaction that happen in top 200 pixels so, scroll won't happen while dragging inside 0 to 200.
Comment 1 Mohan 2020-03-31 10:46:32 PDT
Created attachment 395066 [details]
Repro video
Comment 2 Radar WebKit Bug Importer 2020-03-31 11:39:50 PDT
<rdar://problem/61117640>
Comment 3 Wenson Hsieh 2020-03-31 12:17:37 PDT
Thanks for the report, Mohan!

From your sample project and repro video, it seems like you were testing on iOS 12, but the hardware field of this report states “iOS 13”. Did you confirm that this still reproduces on iOS 13? I briefly ran your application against a version of iOS 13.4, and did not reproduce what you were seeing.

If it works in iOS 13, then it is likely a dupe of https://bugs.webkit.org/show_bug.cgi?id=193494.
Comment 4 Mohan 2020-04-01 05:59:59 PDT
Issue is no longer reproduced in iOS 13. Sorry, thought I tested in iOS 13 as well.  

Thanks lot for the fix Wenson Hsieh.
Comment 5 Mohan 2020-04-01 06:00:30 PDT

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