Hide the phantom empty top bar, keep only the Gin sidebar

Core Navigation's top bar only shows itself when its tools/context/
actions regions are non-empty (`:has(:not(:empty))`). With no blocks
placed in those regions, they still contain whitespace text nodes from
Twig's loop scaffolding, which defeats that check -- the bar rendered
anyway, empty, and pushed page content down to make room for it.

Attached globally via hook_page_attachments() rather than scoped to
/lignes or /dashboard, since the Navigation chrome renders on every
authenticated page, not just our custom routes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 11:09:02 +02:00
co-authored by Claude Sonnet 5
parent e7796754ab
commit 1f357e5f1c
3 changed files with 30 additions and 0 deletions
@@ -0,0 +1,14 @@
/* Core Navigation's top bar (`.top-bar`) only shows itself when its
tools/context/actions regions are non-empty -- but with no blocks placed
there, the regions still contain whitespace text nodes from the Twig
loop scaffolding, which defeats the `:not(:empty)` check. Result: an
empty top bar renders anyway, with the page content pushed down to make
room for it. We only use the Gin sidebar (the left icon rail), so force
the phantom bar off and collapse the space it would otherwise reserve. */
.top-bar {
display: none !important;
}
.top-bar ~ .dialog-off-canvas-main-canvas {
margin-block-start: 0 !important;
}
@@ -24,3 +24,8 @@ dashboard:
dependencies: dependencies:
- core/drupal - core/drupal
- figli_compta_ledger/vue - figli_compta_ledger/vue
admin_chrome:
css:
theme:
css/admin-chrome.css: {}
@@ -152,6 +152,17 @@ function figli_compta_ledger_theme($existing, $type, $theme, $path) {
]; ];
} }
/**
* Implements hook_page_attachments().
*
* Core Navigation's top bar renders empty (whitespace-only regions defeat
* its own :not(:empty) visibility check) on every page, not just admin
* routes -- attach the fix globally rather than per-route.
*/
function figli_compta_ledger_page_attachments(array &$attachments) {
$attachments['#attached']['library'][] = 'figli_compta_ledger/admin_chrome';
}
/** /**
* Implements hook_help(). * Implements hook_help().
*/ */