Bug 195437 - [iOS] Pasting text into Microsoft Visio sometimes zooms and scrolls
Summary: [iOS] Pasting text into Microsoft Visio sometimes zooms and scrolls
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Daniel Bates
Keywords: InRadar, PlatformOnly
Depends on:
Reported: 2019-03-07 14:53 PST by Daniel Bates
Modified: 2019-03-07 22:53 PST (History)
5 users (show)

See Also:

Work-in-progress (1.04 KB, patch)
2019-03-07 14:55 PST, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2019-03-07 14:53:51 PST
It is annoying that sometimes when you paste content into Microsoft Visio that WebKit sometimes zooms and scrolls.

Steps to reproduce:

The following assume you have a hardware keyboard attached and you have some content on the clipboard.

1. Visit <http://portal.office.com> and sign in.
2. Open Visio and create a new document.
3. Drag and drop a shape to the document.
4. Press the Return key to edit the label for the shape.
5. Press Command + V to paste.

Then WebKit will zoom and scroll the page such that the caret is aligned to the right edge of the page before the scrollbar. (Note if you have trouble reproducing then try changing Visio's zoom Control + + or Control + -. You can also try to do that in combination with moving the shape to be closer to the edge of the Visio document).

The expected result is that no zooming or scrolling occur on paste.
Comment 1 Daniel Bates 2019-03-07 14:55:29 PST
Created attachment 363934 [details]
Comment 2 Radar WebKit Bug Importer 2019-03-07 14:55:49 PST
Comment 3 Wenson Hsieh 2019-03-07 16:33:53 PST
Comment on attachment 363934 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=363934&action=review

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:5321
> +    isProgrammaticRefocus = !m_userIsInteracting && m_keyboardIsAttached;

I haven't considered this approach thoroughly yet, but here's a quick comment...

isProgrammaticRefocus seems like a strange name for this variable. The fact that it's always false on non-iOS platforms would imply that it's not possible to programmatically refocus an element there (which is not true!) It's also unclear to me why m_keyboardIsAttached would matter here — an element can always be programmatically focused after it already has focus, regardless of whether or not a hardware keyboard is attached. The difference seems to be whether or not programmatic focus is allowed to bring up the input view.

Is this really about whether or not programmatic focus causes the input view to be shown by default?
Comment 4 Daniel Bates 2019-03-07 17:58:48 PST
Don’t let the name get to you because I don’t like it too and need to think some
more about this code to figure out a) whether this approach is correct b) where the code should live (originally the whole focus due to user interaction was in WebPageIOS and and c) what the name of the variable and existing variables should be called
Comment 5 Daniel Bates 2019-03-07 22:53:21 PST
This bug also happens on Mac when you paste or paste with matching style. Need to try with Chrome/Firefox/Edge.