Commit 9e6f2729 authored by pam@chromium.org's avatar pam@chromium.org

Set focus to the "OK" button when editing a supervised user profile

Since a supervised user can't edit their name, trying to set the focus there
resulted in it ending up on the first element in the tab order. On Mac and
Linux, that was the "Cancel" button, rather than "OK", because the button order
is reversed to fit those platforms' conventions. Set focus more deliberately.

BUG=315532
TEST=new browser_test

Review URL: https://codereview.chromium.org/75363002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235754 0039d316-1c4b-4281-b951-d872f2087c98
parent 9f4a33d4
......@@ -128,7 +128,12 @@ cr.define('options', function() {
chrome.send('requestHasProfileShortcuts', [profileInfo.filePath]);
}
$('manage-profile-name').focus();
var manageNameField = $('manage-profile-name');
// Supervised users cannot edit their names.
if (manageNameField.disabled)
$('manage-profile-ok').focus();
else
manageNameField.focus();
},
/**
......
......@@ -66,6 +66,8 @@ ManageProfileUITest.prototype = {
},
};
// Receiving the new profile defaults in the manage-user overlay shouldn't mess
// up the focus in a visible higher-level overlay.
TEST_F('ManageProfileUITest', 'NewProfileDefaultsFocus', function() {
var self = this;
......@@ -150,17 +152,22 @@ TEST_F('ManageProfileUITest', 'CreateManagedUserText', function() {
assertTrue($('create-profile-managed').disabled);
});
// Managed users should not be able to edit their profile names.
// Managed users should not be able to edit their profile names, and the initial
// focus should be adjusted accordingly.
TEST_F('ManageProfileUITest', 'EditManagedUserNameAllowed', function() {
var nameField = $('manage-profile-name');
this.setProfileManaged_(false);
ManageProfileOverlay.showManageDialog();
assertFalse(nameField.disabled);
expectFalse(nameField.disabled);
expectEquals(nameField, document.activeElement);
OptionsPage.closeOverlay();
this.setProfileManaged_(true);
ManageProfileOverlay.showManageDialog();
assertTrue(nameField.disabled);
expectTrue(nameField.disabled);
expectEquals($('manage-profile-ok'), document.activeElement);
});
// Setting profile information should allow the confirmation to be shown.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment