Bug 220664

Summary: [iOS] Emoji keyboard covers text field on twitter.com/messages
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: hi, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
hi: review+
Patch none

Wenson Hsieh
Reported 2021-01-15 12:27:55 PST
Attachments
Patch (21.94 KB, patch)
2021-01-15 13:01 PST, Wenson Hsieh
hi: review+
Patch (21.93 KB, patch)
2021-01-15 14:45 PST, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2021-01-15 13:01:17 PST
Devin Rousso
Comment 2 2021-01-15 13:28:49 PST
Comment on attachment 417724 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417724&action=review r=me, nice work! > Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1193 > + return !rect.isEmpty() && CGRectContainsRect([self _contentRectForUserInteraction], rect); NIT: here you use `[self _contentRectForUserInteraction]` but below you use `self._contentRectForUserInteraction` 😅 > Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1196 > +- (void)_scrollToRevealSelectionIfNeeded NIT: would `_scrollToAndRevealSelectionIfNeeded` be more clear/accurate? > Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1208 > + WebCore::FloatRect userInteractionContentRect = self._contentRectForUserInteraction; ditto (:1193) > LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:18 > + let initialContentOffsetY = (await UIHelper.contentOffset()).y; Style: yuck. While there's nothing technically wrong with this, I personally recommend not using `await` like this so that it's explicitly clear what's being waited for. > LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:22 > + let contentOffsetY = initialContentOffsetY; Aside: is it worth it (or even possible) to write a test for your horizontal scrolling logic too? Maybe zoom in on the page and pan over before focusing an `<input>`? > LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:25 > + contentOffsetY = (await UIHelper.contentOffset()).y; ditto (:18)
Wenson Hsieh
Comment 3 2021-01-15 13:33:49 PST
Comment on attachment 417724 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417724&action=review Thanks for the review! >> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1193 >> + return !rect.isEmpty() && CGRectContainsRect([self _contentRectForUserInteraction], rect); > > NIT: here you use `[self _contentRectForUserInteraction]` but below you use `self._contentRectForUserInteraction` 😅 Whoops — I'll make this `self._contentRectForUserInteraction`. >> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1196 >> +- (void)_scrollToRevealSelectionIfNeeded > > NIT: would `_scrollToAndRevealSelectionIfNeeded` be more clear/accurate? Sounds good to me! Will rename. >> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:1208 >> + WebCore::FloatRect userInteractionContentRect = self._contentRectForUserInteraction; > > ditto (:1193) This version (dot notation for property access) is preferred. >> LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:18 >> + let initialContentOffsetY = (await UIHelper.contentOffset()).y; > > Style: yuck. While there's nothing technically wrong with this, I personally recommend not using `await` like this so that it's explicitly clear what's being waited for. Sounds good! Changing to just `let initialContentOffset = await UIHelper.contentOffset();`, and then using `initialContentOffset.y` below. >> LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:22 >> + let contentOffsetY = initialContentOffsetY; > > Aside: is it worth it (or even possible) to write a test for your horizontal scrolling logic too? Maybe zoom in on the page and pan over before focusing an `<input>`? Hmm…unfortunately, I'm not sure it's actually possible to write a test for horizontal scrolling, since it would require the software keyboard to grow horizontally (and overlap the selection as a result). >> LayoutTests/editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html:25 >> + contentOffsetY = (await UIHelper.contentOffset()).y; > > ditto (:18) Fixed!
Wenson Hsieh
Comment 4 2021-01-15 14:45:17 PST
EWS
Comment 5 2021-01-15 15:57:24 PST
Committed r271543: <https://trac.webkit.org/changeset/271543> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417742 [details].
Note You need to log in before you can comment on or make changes to this bug.