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

Unified Diff: chrome/browser/resources/chromeos/login/display_manager.js

Issue 11421111: Fixed button focusing in OOBE screens. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up the code. Created 8 years, 1 month 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/chromeos/login/display_manager.js
diff --git a/chrome/browser/resources/chromeos/login/display_manager.js b/chrome/browser/resources/chromeos/login/display_manager.js
index 07fbab324a5f892494c0627e997d152c466f0c94..73104ef92df295adfa3862377efd0102bd3d1a4a 100644
--- a/chrome/browser/resources/chromeos/login/display_manager.js
+++ b/chrome/browser/resources/chromeos/login/display_manager.js
@@ -128,6 +128,14 @@ cr.define('cr.ui.login', function() {
},
/**
+ * Sets focus on a button with the autofocus attribute in the current
+ * screen.
+ */
+ restoreFocus: function() {
+ this.updateFocus_($(this.screens_[this.currentStep_]));
+ },
+
+ /**
* Appends buttons to the button strip.
* @param {Array.<HTMLElement>} buttons Array with the buttons to append.
* @param {string} screenId Id of the screen that buttons belong to.
@@ -160,6 +168,19 @@ cr.define('cr.ui.login', function() {
},
/**
+ * Sets focus on a button with the autofocus attribute.
+ * @param {HTMLElement} screen Screen which controls should be affected.
+ */
+ updateFocus_: function(screen) {
+ var buttons = document.querySelectorAll(
Nikita (slow) 2012/11/28 18:26:26 I think this should be implemented differently. Y
mtomasz 2012/11/28 21:57:42 Isn't screen.buttons getter producing new buttons
Nikita (slow) 2012/11/29 16:08:11 You're right, screen.buttons always creates new el
+ '#' + screen.id + '-controls button');
+ for (var i = 0; i < buttons.length; ++i) {
+ if (buttons[i].autofocus)
+ buttons[i].focus();
Nikita (slow) 2012/11/28 18:26:26 break;
mtomasz 2012/11/28 21:57:42 Done.
+ }
+ },
+
+ /**
* Updates a step's css classes to reflect left, current, or right position.
* @param {number} stepIndex step index.
* @param {string} state one of 'left', 'current', 'right'.
@@ -238,10 +259,12 @@ cr.define('cr.ui.login', function() {
oldStep.classList.contains('right')) {
innerContainer.classList.remove('animation');
oldStep.classList.add('hidden');
+ this.updateFocus_(newStep);
}
- });
+ }.bind(this));
Nikita (slow) 2012/11/28 18:26:26 Have you tested how OOBE works with this change?
mtomasz 2012/11/28 21:57:42 Yes, tested locally.
} else {
oldStep.classList.add('hidden');
+ this.updateFocus_(newStep);
}
} else {
// First screen on OOBE launch.
@@ -252,7 +275,10 @@ cr.define('cr.ui.login', function() {
innerContainer.removeEventListener('webkitTransitionEnd', f);
$('progress-dots').classList.remove('down');
chrome.send('loginVisible', ['oobe']);
- });
+ this.updateFocus_(newStep);
+ }.bind(this));
+ } else {
+ this.updateFocus_(newStep);
}
newHeader.classList.remove('right'); // Old OOBE.
}
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/login/oobe.js » ('j') | chrome/browser/resources/chromeos/login/oobe.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698