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

Unified Diff: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js

Issue 2795353002: WebUI: For cr-dialog, handle Enter keys in paper-inputs. (Closed)
Patch Set: restore some ids that are used in tests Created 3 years, 8 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/resources/settings/site_settings/edit_exception_dialog.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/cr_elements/cr_dialog/cr_dialog.js
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
index 0e197fa099552776aee1e43f7e083202f6fc77ca..bc4d274dbbb7d347a04078ec1f401b3999a891db 100644
--- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
+++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -113,11 +113,15 @@ Polymer({
* @private
*/
onKeypress_: function(e) {
- if (e.target != this)
+ if (!e.target)
dpapad 2017/04/04 23:46:14 Is that possible?
tommycli 2017/04/05 21:07:07 Done.
return;
if (e.key != 'Enter')
return;
+ // Accept Enter keys from either the dialog, or a child paper-input element.
+ if (e.target != this && e.target.tagName != 'PAPER-INPUT')
dpapad 2017/04/04 23:46:14 Can we add a test for this? You can use a <paper-i
tommycli 2017/04/05 21:07:07 Done.
+ return;
+
var actionButton =
this.querySelector('.action-button:not([disabled]):not([hidden])');
if (actionButton) {
« no previous file with comments | « chrome/browser/resources/settings/site_settings/edit_exception_dialog.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698