Bug 209821

Summary: Changing WKWebView ScrollView’s contentInset results in wiggle while selecting a text inside content editable <div>
Product: WebKit Reporter: Mohan <ssk.mohan>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Critical CC: megan_gardner, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: iPhone / iPad   
OS: iOS 13   
Attachments:
Description Flags
Sample iOS Project
none
Repro video none

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 ***