1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 cr.define('options', function() { 6 var FocusManager = cr.ui.FocusManager; 7 var PageManager = cr.ui.pageManager.PageManager; 8 9 function OptionsFocusManager() { 10 } 11 12 cr.addSingletonGetter(OptionsFocusManager); 13 14 OptionsFocusManager.prototype = { 15 __proto__: FocusManager.prototype, 16 17 /** @override */ 18 getFocusParent: function() { 19 var topPage = PageManager.getTopmostVisiblePage().pageDiv; 20 21 // The default page and search page include a search field that is a 22 // sibling of the rest of the page instead of a child. Thus, use the 23 // parent node to allow the search field to receive focus. 24 if (topPage.parentNode.id == 'page-container') 25 return topPage.parentNode; 26 27 return topPage; 28 }, 29 }; 30 31 return { 32 OptionsFocusManager: OptionsFocusManager, 33 }; 34 }); 35