Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/renderer/resources/extensions/web_view.js

Issue 72843002: <webview>: Give tabIndex -1 so that tab order is not affected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Shim that simulates a <webview> tag via Mutation Observers. 5 // Shim that simulates a <webview> tag via Mutation Observers.
6 // 6 //
7 // The actual tag is implemented via the browser plugin. The internals of this 7 // The actual tag is implemented via the browser plugin. The internals of this
8 // are hidden via Shadow DOM. 8 // are hidden via Shadow DOM.
9 9
10 'use strict'; 10 'use strict';
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 }, this); 197 }, this);
198 198
199 return browserPluginNode; 199 return browserPluginNode;
200 }; 200 };
201 201
202 /** 202 /**
203 * @private 203 * @private
204 */ 204 */
205 WebViewInternal.prototype.setupFocusPropagation_ = function() { 205 WebViewInternal.prototype.setupFocusPropagation_ = function() {
206 if (!this.webviewNode_.hasAttribute('tabIndex')) { 206 if (!this.webviewNode_.hasAttribute('tabIndex')) {
207 // <webview> needs a tabIndex in order to respond to keyboard focus. 207 // <webview> needs a tabIndex in order to be focusable.
208 // TODO(fsamuel): This introduces unexpected tab ordering. We need to find 208 // TODO(fsamuel): It would be nice to avoid exposing a tabIndex attribute
209 // a way to take keyboard focus without messing with tab ordering. 209 // to allow <webview> to be focusable.
210 // See http://crbug.com/231664. 210 // See http://crbug.com/231664.
211 this.webviewNode_.setAttribute('tabIndex', 0); 211 this.webviewNode_.setAttribute('tabIndex', -1);
212 } 212 }
213 var self = this; 213 var self = this;
214 this.webviewNode_.addEventListener('focus', function(e) { 214 this.webviewNode_.addEventListener('focus', function(e) {
215 // Focus the BrowserPlugin when the <webview> takes focus. 215 // Focus the BrowserPlugin when the <webview> takes focus.
216 self.browserPluginNode_.focus(); 216 self.browserPluginNode_.focus();
217 }); 217 });
218 this.webviewNode_.addEventListener('blur', function(e) { 218 this.webviewNode_.addEventListener('blur', function(e) {
219 // Blur the BrowserPlugin when the <webview> loses focus. 219 // Blur the BrowserPlugin when the <webview> loses focus.
220 self.browserPluginNode_.blur(); 220 self.browserPluginNode_.blur();
221 }); 221 });
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 * Implemented when the experimental API is available. 1040 * Implemented when the experimental API is available.
1041 * @private 1041 * @private
1042 */ 1042 */
1043 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { 1043 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() {
1044 return []; 1044 return [];
1045 }; 1045 };
1046 1046
1047 exports.WebView = WebView; 1047 exports.WebView = WebView;
1048 exports.WebViewInternal = WebViewInternal; 1048 exports.WebViewInternal = WebViewInternal;
1049 exports.CreateEvent = CreateEvent; 1049 exports.CreateEvent = CreateEvent;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698