Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

KeyboardDisplayRequiresUserAction workaround #184

Closed
clauderic opened this issue Oct 22, 2015 · 5 comments
Closed

KeyboardDisplayRequiresUserAction workaround #184

clauderic opened this issue Oct 22, 2015 · 5 comments

Comments

@clauderic
Copy link

Hey @EddyVerbruggen, I know as per #46 that supporting keyboardDisplayRequiresUserAction out of the box for WKWebView is not possible.

However, someone on the JIRA bug report for this appears to have found a workaround, but I'm way out of my depth trying to apply it. Think you could take a look? https://bugs.webkit.org/show_bug.cgi?id=142757#c3

His workaround:

I've managed to work-around this on at least iOS 9 by swizzling
_startAssistingNode:userIsInteracting:blurPreviousNode:userObject
on  WKContentView and overriding the userIsInteracting value:

Pseudo code:

    swizzle_intercept("WKContentView", "_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:", &hackAssist);

    void hackAssist (id self, SEL _cmd, void* arg0, BOOL arg1, BOOL arg2, id arg3) {
        ((void (*)(id,SEL,void*,BOOL,BOOL,id))swizzle_interceptee(hackAssist))(self, _cmd, arg0, TRUE, arg2, arg3);
    }

Use it to your advantage while the API doesn't change ;). Cheers!
@clauderic clauderic changed the title KeyboardDisplayRequiresUserAction does not work KeyboardDisplayRequiresUserAction workaround Oct 22, 2015
EddyVerbruggen added a commit that referenced this issue Oct 22, 2015
#184 KeyboardDisplayRequiresUserAction workaround
@EddyVerbruggen
Copy link
Contributor

Hey man, you got me on the right track! Support has just landed in 0.6.5, thanks on behalf of all users of this plugin 👍

@clauderic
Copy link
Author

Holy crap that was fast. Mad props man, I can't even begin to find the words to thank you, you just made my day 🙌

Thanks for the awesome work you put in this plugin, it's truly appreciated 👍

reidab added a commit to thedyrt/cordova-plugin-wkwebview-engine that referenced this issue Jan 24, 2017
Swizzle _startAssistingNode to make it seem like the user is interacting. This replicates the behavior of UIWebView's keyboardDisplayRequiresUserAction property.

See:
- https://issues.apache.org/jira/browse/CB-10376
- https://bugs.webkit.org/show_bug.cgi?id=142757#c3
- Telerik-Verified-Plugins/WKWebView#184
- YetiCGN@eb485aa

DYRT-1205
@ccorcos
Copy link

ccorcos commented Mar 30, 2018

Hey there, this doesn't work anymore in the latest iOS 11.3 :( Any ideas?

@SevenSystems
Copy link

We've also been hit by this in our app Xequence, and it's amazing how Apple keeps breaking things for the sake of "usability", breaking that same usability in the process. I'll keep experimenting if I can get this sorted but it ain't looking good.

@vtourraine
Copy link

Fix for iOS 11.3: https://stackoverflow.com/a/48623286/135712

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants