From c3bed743aa1a8be0510ebd5d6f1c2b465d50d3a0 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Mon, 14 Sep 2026 06:09:05 +0200 Subject: [PATCH] Hold the navigation bar item to its own label and state-layer tokens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NavigationBarTokens names one label font for both icon positions, label-medium; the horizontal layout had taken label-large from the rail's item, a different component with a token of its own. And the item's state layer washed in on-surface over a secondary-container pill, where the only state-layer tokens M3 states for a navigation item — the rail's, which the rail already follows — are on-secondary-container for all six states. Plan: docs/plans/material-3-alignment.md, step 21 (navigation N-08, N-19). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- resources/css/components/navigation.css | 14 ++++++++++++-- tests/Feature/Components/NavigationBarTest.php | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/resources/css/components/navigation.css b/resources/css/components/navigation.css index 6d2d9ba1..4ea61e18 100644 --- a/resources/css/components/navigation.css +++ b/resources/css/components/navigation.css @@ -160,14 +160,16 @@ min-width: max-content; } + /* The label stays label-medium: NavigationBarTokens.LabelTextFont is the bar's only label + token, and Compose's ShortNavigationBarItem passes it for both icon positions. (The + *rail's* horizontal item is label-large — NavigationRailHorizontalItemTokens — which is + a different component.) */ [data-navigation-bar-item] [data-navigation-pill] { position: relative; isolation: isolate; flex-direction: row; height: 2.5rem; padding-inline: 1rem; - font: var(--md-sys-typescale-label-lg); - letter-spacing: var(--md-sys-typescale-label-lg-tracking); } [data-navigation-bar-item] [data-navigation-label] { @@ -538,6 +540,14 @@ transition: opacity var(--md-sys-motion-effects-fast-duration) var(--md-sys-motion-effects-fast); } + /* A navigation item's state layer is on-secondary-container, active or not: the only + state-layer tokens M3 states for one are NavigationRailColorTokens', which give that colour + to all six. The rail follows them two blocks below; the bar follows them here, over its + secondary-container pill. */ + [data-navigation-bar-item] :is([data-navigation-indicator], [data-navigation-pill])::before { + background-color: var(--md-sys-color-on-secondary-container); + } + @container (width < 37.5rem) { [data-navigation-bar-item] [data-navigation-pill]::before { display: none; diff --git a/tests/Feature/Components/NavigationBarTest.php b/tests/Feature/Components/NavigationBarTest.php index 25a05cad..f79b2b4e 100644 --- a/tests/Feature/Components/NavigationBarTest.php +++ b/tests/Feature/Components/NavigationBarTest.php @@ -1,5 +1,7 @@ blade('')) ->toContain('