mirror of https://github.com/zulip/zulip.git
settings: Make the enter key go to panels.
This is less than perfect, but for most settings hitting the enter key will now take you to the first element in the right panel. The two exceptions are below. They have checkboxes with kind of strange markup: Notifications Authentication methods
This commit is contained in:
parent
8af04ac3cd
commit
3065bf0c58
|
@ -32,6 +32,7 @@ exports.make_menu = function (opts) {
|
||||||
handlers: {
|
handlers: {
|
||||||
left_arrow: toggler.maybe_go_left,
|
left_arrow: toggler.maybe_go_left,
|
||||||
right_arrow: toggler.maybe_go_right,
|
right_arrow: toggler.maybe_go_right,
|
||||||
|
enter_key: self.enter_panel,
|
||||||
up_arrow: self.prev,
|
up_arrow: self.prev,
|
||||||
down_arrow: self.next,
|
down_arrow: self.next,
|
||||||
},
|
},
|
||||||
|
@ -48,6 +49,15 @@ exports.make_menu = function (opts) {
|
||||||
return true;
|
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) {
|
self.activate_section = function (opts) {
|
||||||
var li_elem = opts.li_elem;
|
var li_elem = opts.li_elem;
|
||||||
var section = li_elem.data('section');
|
var section = li_elem.data('section');
|
||||||
|
@ -65,8 +75,14 @@ exports.make_menu = function (opts) {
|
||||||
|
|
||||||
load_section(section);
|
load_section(section);
|
||||||
|
|
||||||
|
self.get_panel().addClass('show');
|
||||||
|
};
|
||||||
|
|
||||||
|
self.get_panel = function () {
|
||||||
|
var section = curr_li.data('section');
|
||||||
var sel = "[data-name='" + 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) {
|
main_elem.on("click", "li[data-section]", function (e) {
|
||||||
|
|
Loading…
Reference in New Issue