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

Unified Diff: ui/webui/resources/js/cr/ui/overlay.js

Issue 22268005: Prevent overlay enter events from executing two buttons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More comments Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/overlay.js
diff --git a/ui/webui/resources/js/cr/ui/overlay.js b/ui/webui/resources/js/cr/ui/overlay.js
index 293ca20f2caa3175bd89deeff09b3748e3b05451..5c0acb2d3dd826d52e3f76e1a3de7b7127671043 100644
--- a/ui/webui/resources/js/cr/ui/overlay.js
+++ b/ui/webui/resources/js/cr/ui/overlay.js
@@ -58,8 +58,13 @@ cr.define('cr.ui.overlay', function() {
if (e.keyIdentifier == 'Enter' &&
!forbiddenTagNames.test(document.activeElement.tagName)) {
var button = getDefaultButton(overlay);
- if (button)
+ if (button) {
button.click();
+ // Executing the default button may result in focus moving to a
+ // different button. Calling preventDefault is necessary to not have
+ // that button execute as well.
+ e.preventDefault();
+ }
}
});
« no previous file with comments | « chrome/browser/ui/webui/options/options_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698