diff --git a/static/js/settings_panel_menu.js b/static/js/settings_panel_menu.js index 567fab6d4f..d9c2372267 100644 --- a/static/js/settings_panel_menu.js +++ b/static/js/settings_panel_menu.js @@ -32,6 +32,7 @@ exports.make_menu = function (opts) { handlers: { left_arrow: toggler.maybe_go_left, right_arrow: toggler.maybe_go_right, + enter_key: self.enter_panel, up_arrow: self.prev, down_arrow: self.next, }, @@ -48,6 +49,15 @@ exports.make_menu = function (opts) { return true; }; + self.enter_panel = function () { + var panel = self.get_panel(); + var sel = 'input:visible:first,button:visible:first,select:visible:first'; + var panel_elem = panel.find(sel).first(); + + panel_elem.focus(); + return true; + }; + self.activate_section = function (opts) { var li_elem = opts.li_elem; var section = li_elem.data('section'); @@ -65,8 +75,14 @@ exports.make_menu = function (opts) { load_section(section); + self.get_panel().addClass('show'); + }; + + self.get_panel = function () { + var section = curr_li.data('section'); var sel = "[data-name='" + section + "']"; - $(".settings-section" + sel + ", .settings-wrapper" + sel).addClass("show"); + var panel = $(".settings-section" + sel + ", .settings-wrapper" + sel); + return panel; }; main_elem.on("click", "li[data-section]", function (e) {