Skip to content

refactor(navbar): drop the redundant mode-toggle icon width rule - #2101

Merged
markdumay merged 1 commit into
mainfrom
chore/navbar-icon-width-cleanup
Aug 1, 2026
Merged

refactor(navbar): drop the redundant mode-toggle icon width rule#2101
markdumay merged 1 commit into
mainfrom
chore/navbar-icon-width-cleanup

Conversation

@markdumay

Copy link
Copy Markdown
Collaborator

Follow-up to mod-fontawesome#350. Deletes a workaround that only existed because fa-fw did nothing on inline SVG.

Why it existed

FontAwesome v7 sets .fa-fw{--fa-width:1.25em} and only the webfont rule consumed the property. mod-fontawesome's inline-SVG rule hard-set width: auto, so fa-fw was inert — and since Hinode renders icons as inline SVG, that was every icon.

.mode-toggle .label svg { height: 1em; width: 1.25em } compensated for exactly one row. The other navbar controls had no equivalent, which is why the theme toggle and the search/profile rows rendered at different widths and their labels did not line up.

Why it is now redundant

mod-fontawesome v6.1.4 makes the inline-SVG rule read the property, so the base styles produce this geometry unaided:

  • height: 1em from .svg-inline--fa
  • width: 1.25em from the fa-fw that assets/helpers/navbar-mode.html already emits

Verified

Built a consuming site with and without this rule at 390px, where the controls form a labelled column:

                with rule     without rule
toggle icon     20x16         20x16
profile icon    20x16         20x16
label origin    x=42          x=42

Identical. The rows also now agree with each other, which they did not before v6.1.4.

Pill mode (toggle = false, the default) checked separately: both icons render 16x14 inside the 43px pill, scrollWidth == clientWidth, no overflow.

Compatibility

Requires mod-fontawesome >= v6.1.4. Before that, this rule is load-bearing for the toggle.

Left alone deliberately

.mode-switch .fa-moon and .fa-sun set colour and scale rather than width, and they match whenever a site keeps the default fas sun / fas moon icons. They are inert only on sites configuring a different icon set — a site choice, not dead code here.

Checks

pnpm test passes.

`.mode-toggle .label svg { height: 1em; width: 1.25em }` existed because
`fa-fw` had no effect on inline SVG: FontAwesome v7 sets `--fa-width` and
only the webfont rule consumed it. mod-fontawesome v6.1.4 makes the
inline-SVG rule read the property, so the base styles now produce exactly
this geometry on their own — `height: 1em` from `.svg-inline--fa`, and
`width: 1.25em` from the `fa-fw` the helper already emits.

Verified on a consuming site with and without this rule, at 390px where
the controls form a labelled column:

  toggle icon    20x16      identical
  profile icon   20x16      identical
  label origin   x=42       identical for both rows

Requires mod-fontawesome >= v6.1.4. Before that the rule is load-bearing
for the toggle and there is no equivalent for the other controls, which
is why those rows disagreed.

Left alone deliberately: `.mode-switch .fa-moon` and `.fa-sun` set colour
and scale rather than width, and match whenever a site keeps the default
`fas sun` / `fas moon` icons. They are inert only on sites that configure
a different icon set, which is a site choice rather than dead code here.

`pnpm test` passes.
@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for gethinode-demo ready!

Name Link
🔨 Latest commit 0f2e4b4
🔍 Latest deploy log https://app.netlify.com/projects/gethinode-demo/deploys/6a6d8f5b9bdfa3000884af86
😎 Deploy Preview https://deploy-preview-2101--gethinode-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@markdumay
markdumay merged commit eacb017 into main Aug 1, 2026
17 checks passed
@markdumay
markdumay deleted the chore/navbar-icon-width-cleanup branch August 1, 2026 06:28
@markdumay

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 3.12.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant