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

Unified Diff: chrome/browser/resources/settings/languages_page/add_languages_dialog.js

Issue 2523403003: Language settings: fix focus issues (Closed)
Patch Set: rebase Created 4 years 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
Index: chrome/browser/resources/settings/languages_page/add_languages_dialog.js
diff --git a/chrome/browser/resources/settings/languages_page/add_languages_dialog.js b/chrome/browser/resources/settings/languages_page/add_languages_dialog.js
index 43457ca2e1fc70b736c2fdaaf1e4733845e9be1e..0f67c46ce4206e8ee5b31b6fedc03c51b4008945 100644
--- a/chrome/browser/resources/settings/languages_page/add_languages_dialog.js
+++ b/chrome/browser/resources/settings/languages_page/add_languages_dialog.js
@@ -34,10 +34,24 @@ Polymer({
attached: function() {
this.$.dialog.showModal();
- // Fire iron-resize after the list initially displays to prevent flickering.
- setTimeout(function() {
- this.$$('iron-list').fire('iron-resize');
- }.bind(this));
+
+ // Prevent flashing the Cancel button's focus state.
+ this.$$('.cancel-button').blur();
+ setTimeout(this.afterShown_.bind(this));
+ },
+
+ /**
+ * Re-initializes the dialog after it is shown.
+ * @private
+ */
+ afterShown_: function() {
+ // Only fire iron-resize after the list displayed to prevent flickering.
+ this.$$('iron-list').fire('iron-resize');
+
+ // Focus the top checkbox, assuming there are languages left to enable.
+ var firstCheckbox = this.$$('iron-list paper-checkbox');
+ if (firstCheckbox)
+ firstCheckbox.focus();
},
/**

Powered by Google App Engine
This is Rietveld 408576698