diff --git a/resources/views/components/application/configuration-sidebar.blade.php b/resources/views/components/application/configuration-sidebar.blade.php
index 7ecae8856e..071af1febf 100644
--- a/resources/views/components/application/configuration-sidebar.blade.php
+++ b/resources/views/components/application/configuration-sidebar.blade.php
@@ -288,23 +288,17 @@
@endif
- @if (filled($sections))
+ {{-- Sub-sections belong to the current page only; collapse them for
+ every other item so the sidebar stays short. --}}
+ @if ($menuItem['active'] && filled($sections))
@endif
diff --git a/resources/views/livewire/project/service/configuration.blade.php b/resources/views/livewire/project/service/configuration.blade.php
index a129884644..03dedd7991 100644
--- a/resources/views/livewire/project/service/configuration.blade.php
+++ b/resources/views/livewire/project/service/configuration.blade.php
@@ -47,6 +47,9 @@
->values())
->filter(fn ($items) => $items->isNotEmpty());
+ // Group that holds the current page — the only one expanded by default.
+ $activeGroup = (string) $groupedItems->search(fn ($items) => $items->contains(fn ($item) => $item['active'] ?? false));
+
$storageSections = $applications
->concat($databases)
->map(fn ($resource): array => [
@@ -59,13 +62,23 @@
diff --git a/tests/Feature/SettingsSidebarAccordionTest.php b/tests/Feature/SettingsSidebarAccordionTest.php
index fed1ea36d3..3c1f881b30 100644
--- a/tests/Feature/SettingsSidebarAccordionTest.php
+++ b/tests/Feature/SettingsSidebarAccordionTest.php
@@ -8,6 +8,7 @@ $groupedSidebars = [
'application' => 'resources/views/components/application/configuration-sidebar.blade.php',
'database' => 'resources/views/components/database/configuration-sidebar.blade.php',
'service' => 'resources/views/components/service/configuration-sidebar.blade.php',
+ 'service-page' => 'resources/views/livewire/project/service/configuration.blade.php',
'server' => 'resources/views/components/server/sidebar.blade.php',
];
@@ -18,10 +19,20 @@ it('wires the collapsible accordion into every grouped settings sidebar', functi
->toContain('settingsSidebarAccordion(') // shared Alpine data provider
->toContain('$activeGroup') // only the active group opens by default
->toContain('nav-section-toggle') // group header is a toggle button
- ->toContain("toggle(") // header collapses/expands the group
+ ->toContain('toggle(') // header collapses/expands the group
->toContain("? 'xl:block' : 'xl:hidden'"); // desktop-only collapse wrapper
})->with($groupedSidebars);
+it('only expands in-page sub-sections for the active page', function () {
+ // Regression: the application sidebar used to render every item's sub-sections
+ // (Advanced's Build/Container/… showed while you were on General).
+ $contents = file_get_contents(base_path('resources/views/components/application/configuration-sidebar.blade.php'));
+
+ expect($contents)
+ ->toContain("\$menuItem['active'] && filled(\$sections)")
+ ->not->toContain('@if (filled($sections))');
+});
+
it('registers the accordion Alpine provider', function () {
expect(file_get_contents(base_path('resources/js/app.js')))
->toContain('initializeSettingsSidebarAccordionComponent');