diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 15:28:11 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 15:28:11 +0000 |
commit | 33748004d0d20e0df3c026aaa45803604fb8a84a (patch) | |
tree | 60ded00adfefb2ba0ff9a2887006aaff3aa776ad /ui/webui | |
parent | 090550f49c64e02bb0d819ce507e78657630ff06 (diff) | |
download | chromium_src-33748004d0d20e0df3c026aaa45803604fb8a84a.zip chromium_src-33748004d0d20e0df3c026aaa45803604fb8a84a.tar.gz chromium_src-33748004d0d20e0df3c026aaa45803604fb8a84a.tar.bz2 |
Prevent default handling of Enter key when closing prompt dialog.
On confirming a prompt dialog via an "Enter" key press, the dialog may
close and re-focus the element that was active before the dialog opened.
The browser would then take the default action for the event, i.e.
taking the default action on the newly-focused element (such as clicking
the button, opening a combobox menu etc.). This is inappropriate, so
cancel the event to prevent default processing.
BUG=chromium:247646
TEST=Manual: Focus a select element, cause a popup dialog to appear, hit enter. The select dropdown shouldn't open.
Review URL: https://chromiumcodereview.appspot.com/16049018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/webui')
-rw-r--r-- | ui/webui/resources/js/cr/ui/dialogs.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/webui/resources/js/cr/ui/dialogs.js b/ui/webui/resources/js/cr/ui/dialogs.js index 9d2f70e..e6fd5ec 100644 --- a/ui/webui/resources/js/cr/ui/dialogs.js +++ b/ui/webui/resources/js/cr/ui/dialogs.js @@ -274,8 +274,10 @@ cr.define('cr.ui.dialogs', function() { }; PromptDialog.prototype.onKeyDown_ = function(event) { - if (event.keyCode == 13) // Enter + if (event.keyCode == 13) { // Enter this.onOkClick_(event); + event.preventDefault(); + } }; PromptDialog.prototype.show = function(message, defaultValue, onOk, onCancel, |