diff --git a/gui/default/index.html b/gui/default/index.html
index e3e573c9a..5cff97159 100644
--- a/gui/default/index.html
+++ b/gui/default/index.html
@@ -410,8 +410,8 @@
-
-
+
+
@@ -686,8 +686,8 @@
{{deviceName(deviceCfg)}}
-
-
+
+
@@ -805,8 +805,8 @@
{{deviceName(deviceCfg)}}
-
-
+
+
@@ -1083,6 +1083,7 @@
+
diff --git a/gui/default/syncthing/core/lazyCollapseDirective.js b/gui/default/syncthing/core/lazyCollapseDirective.js
new file mode 100644
index 000000000..56a81a256
--- /dev/null
+++ b/gui/default/syncthing/core/lazyCollapseDirective.js
@@ -0,0 +1,25 @@
+angular.module('syncthing.core')
+ .directive('lazyCollapse', function () {
+ return {
+ restrict: 'A',
+ link: function (scope, element) {
+ // Render panel content only while expanded. Collapsed panels
+ // contribute zero watchers. Bootstrap's show/hidden events
+ // fire before/after the animation, so the DOM is present
+ // during the transition.
+ scope.lazyReady = element.hasClass('in');
+
+ $(element).on('show.bs.collapse', function () {
+ scope.$apply(function () {
+ scope.lazyReady = true;
+ });
+ });
+
+ $(element).on('hidden.bs.collapse', function () {
+ scope.$apply(function () {
+ scope.lazyReady = false;
+ });
+ });
+ }
+ };
+ });