summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/form.js
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-03-24 21:57:21 +0100
committerJo-Philipp Wich <jo@mein.io>2020-03-24 22:14:18 +0100
commit82fb5a67d39d965595d2ad833dbf930e559c0202 (patch)
tree58545ae200e3c16614efe8233baeecd5683d0a42 /modules/luci-base/htdocs/luci-static/resources/form.js
parent573fdc045264c904f36a390e68510b557e4def87 (diff)
luci-base: form.js / ui.js: tie form labels to widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 22ba6fc40933bee02c3ea93bbda952bb44bf3af1)
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/form.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index b3133a8d31..917584bb82 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -1644,7 +1644,16 @@ var CBIValue = CBIAbstractValue.extend({
if (typeof(this.title) === 'string' && this.title !== '') {
optionEl.appendChild(E('label', {
'class': 'cbi-value-title',
- 'for': 'widget.cbid.%s.%s.%s'.format(config_name, section_id, this.option)
+ 'for': 'widget.cbid.%s.%s.%s'.format(config_name, section_id, this.option),
+ 'click': function(ev) {
+ var node = ev.currentTarget,
+ elem = node.nextElementSibling.querySelector('#' + node.getAttribute('for')) || node.nextElementSibling.querySelector('[data-widget-id="' + node.getAttribute('for') + '"]');
+
+ if (elem) {
+ elem.click();
+ elem.focus();
+ }
+ }
},
this.titleref ? E('a', {
'class': 'cbi-title-ref',