Chromium Code Reviews| 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..4d682c57b3fbb68b144921bd25b1a4af93e46da9 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)); |
| + // To prevent flashing the Cancel button focus, "focus" the disabled Add |
| + // button, so nothing has a focus state until the afterShown_ call. |
| + this.$$('.action-button').focus(); |
|
stevenjb
2016/11/28 17:49:16
This seems klugey. Can we just blur the cancel but
michaelpg
2016/12/01 23:19:13
Done. Thought I had tried that!
|
| + setTimeout(this.afterShown_.bind(this)); |
| + }, |
| + |
| + /** |
| + * Re-initializes the dialog after it is shown. |
| + * @private |
| + */ |
| + afterShown_: function() { |
| + // Only fire iron-list after the list displayed to prevent flickering. |
|
stevenjb
2016/11/28 17:49:16
'fire iron-resize' ?
michaelpg
2016/12/01 23:19:13
Done.
|
| + 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(); |
| }, |
| /** |