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

Unified Diff: chrome/browser/resources/login/user_pod_row.js

Issue 373813002: User manager: fix deleting desktop/managed users with the keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/login/user_pod_row.js
diff --git a/chrome/browser/resources/login/user_pod_row.js b/chrome/browser/resources/login/user_pod_row.js
index a4b8a85bc9d6d7bc910c671766d0ee4f2dfea833..ebc377890cb872ae55d7e1d004ec4754d8edd89c 100644
--- a/chrome/browser/resources/login/user_pod_row.js
+++ b/chrome/browser/resources/login/user_pod_row.js
@@ -201,6 +201,9 @@ cr.define('login', function() {
this.actionBoxRemoveUserWarningButtonElement.addEventListener(
'click',
this.handleRemoveUserConfirmationClick_.bind(this));
+ this.actionBoxRemoveUserWarningButtonElement.addEventListener(
+ 'keydown',
+ this.handleRemoveUserConfirmationKeyDown_.bind(this));
}
},
@@ -864,6 +867,7 @@ cr.define('login', function() {
showRemoveWarning_: function() {
this.actionBoxMenuRemoveElement.hidden = true;
this.actionBoxRemoveUserWarningElement.hidden = false;
+ this.actionBoxRemoveUserWarningButtonElement.focus();
},
/**
@@ -871,8 +875,34 @@ cr.define('login', function() {
* @param {Event} e Click event.
*/
handleRemoveUserConfirmationClick_: function(e) {
- if (this.isActionBoxMenuActive)
- chrome.send('removeUser', [this.user.username]);
+ if (this.isActionBoxMenuActive) {
+ this.isActionBoxMenuActive = false;
+ chrome.send('removeUser',
Nikita (slow) 2014/07/08 11:58:53 nit: Make sense to extract chrome.send('removeUse
noms (inactive) 2014/07/08 14:14:48 Done.
+ [this.user.isDesktopUser ? this.user.profilePath :
+ this.user.username]);
+ e.stopPropagation();
+ }
+ },
+
+ /**
+ * Handles a keydown event on remove user confirmation button.
+ * @param {Event} e KeyDown event.
+ */
+ handleRemoveUserConfirmationKeyDown_: function(e) {
+ if (!this.isActionBoxMenuActive)
+ return;
+
+ // Only handle pressing 'Enter' or 'Space', and let all other events
+ // bubble to the action box menu.
+ if (e.keyIdentifier == 'Enter' || e.keyIdentifier == 'U+0020') {
+ this.isActionBoxMenuActive = false;
+ chrome.send('removeUser',
+ [this.user.isDesktopUser ? this.user.profilePath :
+ this.user.username]);
+ e.stopPropagation();
+ // Prevent default so that we don't trigger a 'click' event.
+ e.preventDefault();
+ }
},
/**
@@ -884,7 +914,14 @@ cr.define('login', function() {
return;
switch (e.keyIdentifier) {
case 'Enter':
- chrome.send('removeUser', [this.user.username]);
+ if (this.user.locallyManagedUser || this.user.isDesktopUser) {
+ // Prevent default so that we don't trigger a 'click' event on the
+ // remove button that will be focused.
+ e.preventDefault();
+ this.showRemoveWarning_();
+ } else {
+ chrome.send('removeUser', [this.user.username]);
+ }
e.stopPropagation();
break;
case 'Up':
@@ -1279,11 +1316,6 @@ cr.define('login', function() {
if (this.isAuthTypeUserClick)
chrome.send('attemptUnlock', [this.user.emailAddress]);
},
-
- /** @override */
- handleRemoveUserConfirmationClick_: function(e) {
- chrome.send('removeUser', [this.user.profilePath]);
- },
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698