| Index: ui/webui/resources/js/cr/ui/focus_manager.js
|
| diff --git a/ui/webui/resources/js/cr/ui/focus_manager.js b/ui/webui/resources/js/cr/ui/focus_manager.js
|
| index e7ba2a8aca0d87252e9aafca5e41316a86a139ee..270e267d7ab78d22a2f9b97f8b84232c1def7df3 100644
|
| --- a/ui/webui/resources/js/cr/ui/focus_manager.js
|
| +++ b/ui/webui/resources/js/cr/ui/focus_manager.js
|
| @@ -177,20 +177,35 @@ cr.define('cr.ui', function() {
|
| true);
|
| document.addEventListener('keydown', this.onDocumentKeyDown_.bind(this),
|
| true);
|
| -
|
| - document.addEventListener('mousedown', function(event) {
|
| - var tagName = event.target.tagName;
|
| - if (tagName != 'BUTTON' && tagName != 'INPUT')
|
| - return;
|
| - var type = event.target.type;
|
| - if (type == 'button' || type == 'reset' || type == 'submit' ||
|
| - type == 'radio' || type == 'checkbox') {
|
| - event.preventDefault();
|
| - }
|
| - }, false);
|
| },
|
| };
|
|
|
| + /**
|
| + * Disable mouse-focus for button controls.
|
| + * Button form controls are mouse-focusable since Chromium 30. We want the
|
| + * old behavior in some WebUI pages.
|
| + */
|
| + FocusManager.disableMouseFocusOnButtons = function() {
|
| + document.addEventListener('mousedown', function(event) {
|
| + if (event.button != 0)
|
| + return;
|
| + var node = event.target;
|
| + var tagName = node.tagName;
|
| + if (tagName != 'BUTTON' && tagName != 'INPUT') {
|
| + do {
|
| + node = node.parentNode;
|
| + if (!node || node.nodeType != Node.ELEMENT_NODE)
|
| + return;
|
| + } while (node.tagName != 'BUTTON');
|
| + }
|
| + var type = node.type;
|
| + if (type == 'button' || type == 'reset' || type == 'submit' ||
|
| + type == 'radio' || type == 'checkbox') {
|
| + event.preventDefault();
|
| + }
|
| + }, false);
|
| + };
|
| +
|
| return {
|
| FocusManager: FocusManager,
|
| };
|
|
|