summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2020-11-24 02:36:50 +0100
committerAnsuel Smith <ansuelsmth@gmail.com>2020-11-24 02:36:50 +0100
commit84ba852993612701060410e7497c3c8d5f6f9c11 (patch)
tree52f3686a4d318c95206f472ae4adfe02e8bd90df
parent44d02afab15f3e7b30d6f5c24854e850b20dba57 (diff)
luci-base: delay cbi-tab-active event on tab init
Delay the cbi-tab-active custom event so any eventListner attached to the tab doesn't miss the first event. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js
index 77074d5075..e35a26a8ba 100644
--- a/modules/luci-base/htdocs/luci-static/resources/ui.js
+++ b/modules/luci-base/htdocs/luci-static/resources/ui.js
@@ -3597,9 +3597,11 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
this.setActiveTabId(panes[selected], selected);
}
- panes[selected].dispatchEvent(new CustomEvent('cbi-tab-active', {
- detail: { tab: panes[selected].getAttribute('data-tab') }
- }));
+ requestAnimationFrame(L.bind(function(pane) {
+ pane.dispatchEvent(new CustomEvent('cbi-tab-active', {
+ detail: { tab: pane.getAttribute('data-tab') }
+ }));
+ }, this, panes[selected]));
this.updateTabs(group);
},