Skip to content

WEBDEV-9250: Size the topnav from its own scale unit - #137

Open
jbuckner wants to merge 1 commit into
WEBDEV-9221-localize-topnav-menusfrom
WEBDEV-9250-topnav-font-scale
Open

jbuckner wants to merge 1 commit into
WEBDEV-9221-localize-topnav-menusfrom
WEBDEV-9250-topnav-font-scale

Conversation

@jbuckner

@jbuckner jbuckner commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Converts the topnav's rem sizing (every size assumed a 10px html root, so it only rendered right on pages that set html { font-size: 10px } like archive.org and offshoot) to calc(N * var(--topnavUnit--)).

--topnavUnit-- is keyed off the browser's own default font size, not the page's root font-size: ia-topnav's :host sets font-size: var(--topnavFontSize, medium) (medium is the browser default, ignoring any html rem reset) and --topnavUnit--: calc(1em / 16), registered as a typed <length> custom property so it resolves once and inherits as a fixed px value through nested shadow roots instead of compounding. A JS fallback covers browsers without CSS.registerProperty (old Firefox/Safari).

Result: the topnav renders pixel-identical to today at the browser's 16px default, with no consumer override needed anywhere, and it grows when the user raises their default font size (confirmed in Chromium, Firefox and WebKit). Neither petabox nor offshoot needs a change for this.

Jira: https://webarchive.jira.com/browse/WEBDEV-9250

🤖 Generated with Claude Code

Converts the topnav's rem sizing to calc(N * var(--topnavUnit--)),
where --topnavUnit-- is keyed off the browser's default font size
(font-size: var(--topnavFontSize, medium) + CSS.registerProperty)
rather than the page's html root font-size. Includes a JS fallback
for browsers without CSS.registerProperty, and tests proving the
registration is load-bearing against compounding.

WIP checkpoint: lint/typecheck/tests all green, third diff-review
pass in flight. Not yet squashed/finalized; PR not yet opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jbuckner
jbuckner marked this pull request as ready for review October 1, 2026 23:55
@jbuckner
jbuckner added this pull request to stack #126 October 1, 2026 23:55
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-137/

Built to branch ghpages at 2026-10-01 23:55 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.54%. Comparing base (61aa77a) to head (15f26a6).

Files with missing lines Patch % Lines
src/elements/ia-topnav/lib/register-topnav-unit.ts 54.54% 3 Missing and 2 partials ⚠️
src/elements/ia-topnav/ia-topnav.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           WEBDEV-9221-localize-topnav-menus     #137      +/-   ##
=====================================================================
- Coverage                              89.69%   89.54%   -0.16%     
=====================================================================
  Files                                     83       84       +1     
  Lines                                   3009     3022      +13     
  Branches                                 717      722       +5     
=====================================================================
+ Hits                                    2699     2706       +7     
- Misses                                   135      138       +3     
- Partials                                 175      178       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants