summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-01-18 20:14:47 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-01-18 20:14:47 +0100
commit2bd428ad8a76cad41c1d7cf5d6196ca62ab07695 (patch)
tree846fcab28bd2c5ddb4af95ca9223888b59e0e5ea /modules/luci-base
parent5eaf4cc489c0e8cd1ffdfde4355866cb5a481d96 (diff)
luci-base: cbi: prevent unintended focus on combobox init
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index fcf87adcb..55e0c4d0a 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -545,7 +545,7 @@ function cbi_bind(obj, type, callback, mode) {
return obj;
}
-function cbi_combobox(id, values, def, man) {
+function cbi_combobox(id, values, def, man, focus) {
var selid = "cbi.combobox." + id;
if (document.getElementById(selid)) {
return
@@ -605,6 +605,7 @@ function cbi_combobox(id, values, def, man) {
cbi_bind(sel, "change", function() {
if (sel.selectedIndex == sel.options.length - 1) {
obj.style.display = "inline";
+ sel.blur();
sel.parentNode.removeChild(sel);
obj.focus();
} else {
@@ -619,16 +620,18 @@ function cbi_combobox(id, values, def, man) {
})
// Retrigger validation in select
- sel.focus();
- sel.blur();
+ if (focus) {
+ sel.focus();
+ sel.blur();
+ }
}
function cbi_combobox_init(id, values, def, man) {
var obj = document.getElementById(id);
cbi_bind(obj, "blur", function() {
- cbi_combobox(id, values, def, man)
+ cbi_combobox(id, values, def, man, true);
});
- cbi_combobox(id, values, def, man);
+ cbi_combobox(id, values, def, man, false);
}
function cbi_filebrowser(id, url, defpath) {