From 8b8b330558e1e272b03da412551ec4c4d683cf3f Mon Sep 17 00:00:00 2001 From: "rsimha@chromium.org" Date: Wed, 14 Aug 2013 23:37:37 +0000 Subject: Merge 217676 "[sync] Fix focus issue in advanced sync settings d..." > [sync] Fix focus issue in advanced sync settings dialog > > When the user uses the keyboard to move between the "Sync everything" > and "Choose what to sync" options in the main drop-down menu of the > advanced sync settings dialog, the focus automatically gets transferred > over to the OK button instead of remaining with the drop-down menu. > > This patch switches things around to assign focus to the correct element > only while originally displaying the dialog, and avoids the focus-stealing > that was going on when the drop-down menu choice changed. > > BUG=272059 > TEST=Use the keyboard to switch between items in the advanced sync dialog > > Review URL: https://chromiumcodereview.appspot.com/23092003 TBR=rsimha@chromium.org Review URL: https://codereview.chromium.org/22867007 git-svn-id: svn://svn.chromium.org/chrome/branches/1547/src@217698 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/sync_setup_overlay.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js index ed234f3..dd2d44f 100644 --- a/chrome/browser/resources/sync_setup_overlay.js +++ b/chrome/browser/resources/sync_setup_overlay.js @@ -545,7 +545,8 @@ cr.define('options', function() { this.useEncryptEverything_ = args.encryptAllData; // Determine whether to display the 'OK, sync everything' confirmation - // dialog or the advanced sync settings dialog. + // dialog or the advanced sync settings dialog, and assign focus to the + // OK button, or to the passphrase field if a passphrase is required. this.usePassphrase_ = args.usePassphrase; this.keystoreEncryptionEnabled_ = args.keystoreEncryptionEnabled; if (args.showSyncEverythingPage == false || this.usePassphrase_ || @@ -554,8 +555,13 @@ cr.define('options', function() { DataTypeSelection.SYNC_EVERYTHING : DataTypeSelection.CHOOSE_WHAT_TO_SYNC; this.showCustomizePage_(args, index); + if (args.showPassphrase) + $('passphrase').focus(); + else + $('choose-datatypes-ok').focus(); } else { this.showSyncEverythingPage_(); + $('confirm-everything-ok').focus(); } } }, @@ -594,8 +600,6 @@ cr.define('options', function() { if (!this.useEncryptEverything_ && !this.usePassphrase_) $('basic-encryption-option').checked = true; - - $('confirm-everything-ok').focus(); }, /** @@ -658,7 +662,6 @@ cr.define('options', function() { !(args.usePassphrase && args.passphraseFailed); $('sync-passphrase-warning').hidden = false; - $('passphrase').focus(); }, /** @@ -690,10 +693,6 @@ cr.define('options', function() { this.setDataTypeCheckboxesEnabled_( index == DataTypeSelection.CHOOSE_WHAT_TO_SYNC); - // The passphrase input may need to take over focus from the OK button, so - // set focus before that logic. - $('choose-datatypes-ok').focus(); - if (args && args.showPassphrase) { this.showPassphraseContainer_(args); } else { -- cgit v1.1