Index: chrome/renderer/resources/extensions/web_view.js |
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js |
index dc91c248dd4ba12d1bbf21f474e5be5c715d0bbc..1caaf0826d4b010e2ff19b663c0a762a243ae170 100644 |
--- a/chrome/renderer/resources/extensions/web_view.js |
+++ b/chrome/renderer/resources/extensions/web_view.js |
@@ -63,11 +63,25 @@ function WebView(node) { |
} |
}, this); |
+ if (!this.node_.hasAttribute('tabIndex')) { |
+ // <webview> needs a tabIndex in order to respond to keyboard focus. |
+ // TODO(fsamuel): Maybe we should fix this so that it's not required. |
+ this.node_.setAttribute('tabIndex', 0); |
lazyboy
2013/04/15 21:46:58
This feels too hacky though, and would trigger inc
Fady Samuel
2013/04/15 22:15:28
Unfortunately, that didn't work. I've added a bug
|
+ } |
+ var self = this; |
+ this.node_.addEventListener('focus', function(e) { |
+ // Focus the BrowserPlugin when the <webview> takes focus. |
+ self.objectNode_.focus(); |
+ }); |
+ this.node_.addEventListener('blur', function(e) { |
+ // Blur the BrowserPlugin when the <webview> loses focus. |
+ self.objectNode_.blur(); |
+ }); |
+ |
shadowRoot.appendChild(this.objectNode_); |
// this.objectNode_[apiMethod] are not necessarily defined immediately after |
// the shadow object is appended to the shadow root. |
- var self = this; |
forEach(WEB_VIEW_API_METHODS, function(i, apiMethod) { |
node[apiMethod] = function(var_args) { |
return self.objectNode_[apiMethod].apply(self.objectNode_, arguments); |