Skip to content

Commit ae87c6c

Browse files
Fix VM quick rail anchoring on widget collapse
1 parent 57f9c1b commit ae87c6c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/folderview.plus/usr/local/emhttp/plugins/folderview.plus/scripts/dashboard.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,11 @@ const ensureDashboardWidgetLayoutQuickSwitchForType = (type) => {
571571
let $host = $(hostSelector).first();
572572
if (!$host.length) {
573573
$host = $(`<div class="fv-dashboard-layout-inline-host fv-dashboard-quick-rail-host" data-fv-dashboard-type="${resolvedType}"></div>`);
574-
$container.addClass('fv-dashboard-layout-inline-container');
574+
$container.prepend($host);
575+
} else if (!$host.parent().is($container)) {
575576
$container.prepend($host);
576577
}
578+
$container.addClass('fv-dashboard-layout-inline-container');
577579
if (!$host.hasClass('fv-dashboard-quick-rail-host')) {
578580
$host.addClass('fv-dashboard-quick-rail-host');
579581
}
@@ -857,7 +859,7 @@ const bindDashboardWidgetVisibilityObserverForType = (type) => {
857859
});
858860
const nodesToObserve = [];
859861
let current = containerNode;
860-
for (let depth = 0; current && depth < 8; depth += 1) {
862+
for (let depth = 0; current && depth < 16; depth += 1) {
861863
if (current instanceof Element) {
862864
nodesToObserve.push(current);
863865
}

tests/dashboard-layout-regression.test.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ test('dashboard runtime supports layout classes, accordion guards, and overflow
100100
assert.match(dashboardScript, /const normalizeDashboardOverflowMode = \(value\) =>/);
101101
assert.match(dashboardScript, /const applyDashboardLayoutStateForType = \(type\) =>/);
102102
assert.match(dashboardScript, /const scheduleDashboardLayoutApplyForType = \(type\) =>/);
103+
assert.match(dashboardScript, /\$host\.parent\(\)\.is\(\$container\)/);
104+
assert.match(dashboardScript, /\$container\.prepend\(\$host\)/);
103105
assert.match(dashboardScript, /if \(layout === 'accordion'\) \{/);
104106
assert.match(dashboardScript, /data-fv-dashboard-overflow="\$\{overflowMode\}"/);
105107
assert.match(dashboardScript, /class="fv-dashboard-expand-toggle-btn"/);

0 commit comments

Comments
 (0)