(edited to give a better description of the answer I gave)
I have created a very simple browser in InterfaceBuilder consisting of a nav bar and a webview.
Everything works fine except when I try to tab between input fields is the webview, the focus goes to the nav bar.
I'm assuming I need to do something with the responder chain, but I haven't been able to figure out what.
Any advice?
Thanks, Kelly
There is probably no one else in the world who cares about this, but I'm going to answer it in case someone needs this at some point.
As I mentioned in the comments, I am using the cappuccino framework and I was actually having 3 different problems.
Let me give you the set up here.
I was creating a cocoa app with a WebView embedded and loading a page with a cappuccino app in it. At first tabbing between fields didn't quite work for any form on any webpage.
Second was the problem where keyCode and charCode in the dom event was different from WebView in cocoa to Safari. It turns out that there is something called 'keyboard quirks' mode. If you look for _needsKeyboardEventDisambiguationQuirks
in the
WebView ObjC class source
you will see that it makes an exception for safari, turning it off. It is supposed to turn it off for older versions of WebKit, but it doesn't. see webkit bug 32694
To solve this, I had to do two different things.
a) override _needsKeyboardEventDisambiguationQuirks
so that it returns NO
b) if the WebView is already instantiated when you override that method, you will need to also call [[webviewinstance preferences] _postPreferencesChangesNotification]
in order to get it to work.
This then makes your WebView send the DOM Events like Safari.
Finally, cappuccino was looking at the user agent string to determine how to handle some stuff. It was checking for WebKit and for Safari. I cribbed the safari user agent string and set that as a custom user agent string for the WebView.
[mywebviewinstance setCustomUserAgent: @"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4"]
Finally, everything worked just like it did in safari.
Hope this helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With