# navbar-header

Sticky site header that turns solid with a blur on scroll, hides on scroll down and returns on scroll up, plus an accessible mobile drawer (aria-expanded, Esc to close, focus moves in). Plain HTML/CSS/JS.

- **Space:** web-development-public (https://github.com/Tech-Realm/space-web-development-public/tree/main/navbar-header)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, playwright-python, chromium
- **Routes:** static-local; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use web-development-public/navbar-header` or MCP `get_pack web-development-public/navbar-header`
- **Files:** CHANGELOG.md, code/_shots/shot-1280-rm.png, code/_shots/shot-1280.png, code/_shots/shot-390-rm.png, code/_shots/shot-390.png, code/index.html, code/nav.js, code/style.css, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/steps.json, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal
A header that works on every page of a marketing site: readable over a hero image or video, solid once the user scrolls, out of the way while reading, and fully usable on a 390 px phone with a keyboard or screen reader.

## Steps
1. Copy `code/index.html` (header markup only), `code/style.css` (the `.site-header` to `.nav-drawer` rules) and `code/nav.js`.
2. Set brand name, links and the primary CTA. Keep at most 5 top-level links; move the rest into the footer.
3. Tune the tokens at the top of `style.css`: `--bg`, `--fg`, `--accent`, `--header-h`.
4. Keep the three states driven by data attributes: `data-state="top|scrolled"` (transparent vs solid + blur after 24 px) and `data-hidden` (hide on scroll down past 240 px, show on any scroll up).
5. Mobile (<= 860 px): links and actions collapse into the toggle. The toggle sets `aria-expanded`, swaps its label, opens `#nav-drawer`, locks body scroll and moves focus to the first link. Esc closes and returns focus to the toggle; tapping a link closes it.
6. Add `html { scroll-padding-top }` equal to the header height so anchor links are not hidden under the fixed header.
7. Run the outcome checks.

## Edge cases
- Header over a light hero: start with dark text or add a subtle top gradient; test contrast in the `top` state.
- Never hide the header while the drawer is open, near the top of the page, or with `prefers-reduced-motion: reduce`.
- iOS Safari: `backdrop-filter` needs the `-webkit-` prefix; keep a semi-opaque background as the fallback.
- Resize from mobile to desktop with the drawer open: the media-query listener closes it.
- Long brand names: the brand must not push the toggle off-screen at 390 px (no horizontal scroll check).

## Don'ts
- No hamburger on desktop when the links fit.
- No duplicate controls for the same job (one menu button, one CTA).
- Do not animate layout properties on scroll (only transform and colors); do not attach unthrottled scroll handlers (use rAF).



---

Canonical URL: https://logicpacks.io/packs/web-development-public/navbar-header

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
