From 1f357e5f1cf774934bd43482187a66410d48c052 Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 4 Sep 2026 11:09:02 +0200 Subject: [PATCH] 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 --- .../figli_compta_ledger/css/admin-chrome.css | 14 ++++++++++++++ .../figli_compta_ledger.libraries.yml | 5 +++++ .../figli_compta_ledger/figli_compta_ledger.module | 11 +++++++++++ 3 files changed, 30 insertions(+) create mode 100644 web/modules/custom/figli_compta_ledger/css/admin-chrome.css diff --git a/web/modules/custom/figli_compta_ledger/css/admin-chrome.css b/web/modules/custom/figli_compta_ledger/css/admin-chrome.css new file mode 100644 index 0000000..17725a1 --- /dev/null +++ b/web/modules/custom/figli_compta_ledger/css/admin-chrome.css @@ -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; +} diff --git a/web/modules/custom/figli_compta_ledger/figli_compta_ledger.libraries.yml b/web/modules/custom/figli_compta_ledger/figli_compta_ledger.libraries.yml index dff120b..62824e4 100644 --- a/web/modules/custom/figli_compta_ledger/figli_compta_ledger.libraries.yml +++ b/web/modules/custom/figli_compta_ledger/figli_compta_ledger.libraries.yml @@ -24,3 +24,8 @@ dashboard: dependencies: - core/drupal - figli_compta_ledger/vue + +admin_chrome: + css: + theme: + css/admin-chrome.css: {} diff --git a/web/modules/custom/figli_compta_ledger/figli_compta_ledger.module b/web/modules/custom/figli_compta_ledger/figli_compta_ledger.module index cce3257..3833e4d 100644 --- a/web/modules/custom/figli_compta_ledger/figli_compta_ledger.module +++ b/web/modules/custom/figli_compta_ledger/figli_compta_ledger.module @@ -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(). */