Press Tab inside an overflow: hidden card and watch it scroll itself crooked — with no scrollbar to get back. This skill tests live focus-scroll traps, walks every sticky ancestor, and seals modal scrollbar jumps and scroll chaining without touching your layout.

Press Tab to focus hidden Step 2 input
STEP 1 OF 2overflow: hidden

Name your workspace

Studio Kestrel
STEP 2 (OFF-SCREEN)

Invite teammate

Beforeoverflow: hidden · scrollLeft 0px
STEP 1 OF 2overflow: clip

Name your workspace

Studio Kestrel
STEP 2 (INERT)

Invite teammate

Afteroverflow: clip + inert · 0px

Install

Copy the skill URL or pick your coding agent below. One file, no npm packages, MIT licensed.

https://hairlineui.com/skills/fix-scroll.md

Claude Code

Works in: Claude Code CLI, VS Code & JetBrains extensions, and Claude Desktop Code tab

Run this once inside your project (or use ~/.claude/skills for every project).

terminal
mkdir -p .claude/skills/fix-scroll && curl -sL https://hairlineui.com/skills/fix-scroll.md -o .claude/skills/fix-scroll/SKILL.md

Restart or type /fix-scroll in Claude Code. It scans the repo, runs the Chromium verifier, and reports every fix.

  • Zero redesign risk. Leaves your layout, brand colours, typography and component library alone.

  • Verified, not guessed. Every skill pairs static checks with a standalone verifier that proves the before and after counts.

  • No lock-in, MIT. Plain markdown plus a standalone script. Works on React, Next.js, Vue, Svelte, Astro or plain HTML.

What it catches

Every rule targets an objective browser defect and pairs a detection check with a root-cause fix.

  1. overflow: hidden scrolling crooked on Tab

    overflow: hidden is still programmatically scrollable — focusing a control near or past the edge shifts the card permanently off-axis.

    Replaces overflow-hidden with overflow-clip (plus inert on collapsed folds), forbidding programmatic scroll completely.

  2. Ancestors silently breaking position: sticky

    Any parent using overflow-x: hidden creates a scroll container and stops sticky headers, toolbars, and sidebars from sticking.

    Switches wrapper containers to overflow-x: clip so clipping stays intact while position: sticky keeps working.

  3. Modal open shifting the navbar 15px sideways

    Hiding the scrollbar when a dialog opens widens the viewport by ~15px on Windows/Linux and jolts the entire header sideways.

    Declares html { scrollbar-gutter: stable } statically and locks scroll on the overlay instead of toggling html overflow.

  4. Scroll chaining bleeding behind drawers

    Reaching the top or bottom of a sidebar, chat list, or modal drags the main page behind it.

    Adds overscroll-behavior: contain (overscroll-contain) to every independent scroll container.

  5. showModal() jerking sheets & popping keyboards

    Native showModal() auto-focuses the first input inside an off-screen panel, jerking the entrance and opening mobile keyboards.

    Uses overflow: clip on dialog roots and focuses the panel container (tabIndex={-1}) on open instead of the first field.

  6. Dropdowns sliced in half by cards

    Absolute popovers and select menus rendered inside overflow-hidden cards get clipped at the card edge.

    Moves floating menus to a portal with collision padding so they stay clear of their trigger and viewport edges.

Chromium verifier

Focuses real interactive descendants inside overflow: hidden containers to catch containers that scroll crooked, walks every ancestor of every position: sticky element for hidden/auto blockers, checks html scrollbar-gutter: stable, triggers dialogs to detect clientWidth/navbar shifts, and flags scrollable drawers missing overscroll-behavior: contain.

curl -sL https://hairlineui.com/skills/fix-scroll-check.mjs -o /tmp/fix-scroll-check.mjsnode /tmp/fix-scroll-check.mjs http://localhost:3000 --routes /,/dashboard,/settings

Then just run it

Run it on a single page while building, or across your main routes before shipping.

  • “Run /fix-scroll across our dashboard and settings routes — fix every broken sticky header and overflow:hidden focus trap.”

  • “Audit our modals and sidebars with /fix-scroll so opening dialogs stops shifting the navbar 15px sideways.”

  • “Find every scrollable drawer and panel missing overscroll-contain using /fix-scroll.”

Source

Read every line before installing. Both files are plain text under the MIT licence.

---name: fix-scrolldescription: Find and fix the 6 scroll and overlay bugs that make web apps feel broken: overflow:hidden containers scrolling crooked on Tab focus, ancestors silently killing position:sticky, modal scroll locks shifting the navbar 15px sideways, scroll chaining bleeding behind modals and sidebars, showModal() auto-focus jerking sheets open, and clipped popovers. Works on any React, Next.js, Vue, Svelte, Astro, or plain CSS/Tailwind app.license: MITmetadata:  author: Hairline UI  url: https://hairlineui.com/skills/fix-scroll  version: "1.0.0"---# /fix-scrollFind and fix the six scroll and overlay defects hiding inside almost every web app: `overflow: hidden` panels silently scrolling themselves crooked when a user presses `Tab`, ancestors killing `position: sticky`, modals deleting the scrollbar and jolting the navbar 15px sideways, scroll chaining bleeding through sidebars/drawers onto the page behind them, `showModal()` jerking sheets open, and dropdowns sliced in half by cards.This skill is **zero-redesign and zero-lock-in**. It leaves your visual design, layout, and component library untouched and verifies every fix in real Chromium.## Guardrails (never break these)- **Never replace a real scroll container (`overflow: auto` / `overflow: scroll`) with `overflow: clip`.** Only replace `overflow: hidden` where the intent is visual clipping (cards, modals, accordions, animated stages, page wrappers), never where the user is supposed to scroll.- **Never lock background scroll by toggling `overflow: hidden` on `<html>` or `<body>`.** That shifts the layout by the scrollbar width on Windows/Linux and triggers heavy full-DOM restyles. Use static `scrollbar-gutter: stable` + overlay scroll interception instead.- **Keep keyboard accessibility intact.** Moving initial dialog focus to the panel itself (`tabIndex={-1}`) preserves Escape and Tab trapping without yanking off-screen controls into view.- **Never add external libraries.** Every fix is standard CSS, HTML, and DOM events.- **Never report a fix you did not verify in Chromium.**---## Step 1 — Measure the baseline (browser + source scan)### 1A. Run the Chromium scroll & overlay verifier (recommended)With your local dev server running, fetch and run the standalone verifier across your main routes:```bashcurl -sL https://hairlineui.com/skills/fix-scroll-check.mjs -o /tmp/fix-scroll-check.mjsnode /tmp/fix-scroll-check.mjs http://localhost:3000 --routes /,/dashboard,/settings```*(On Windows PowerShell: `curl.exe -sL https://hairlineui.com/skills/fix-scroll-check.mjs -o $env:TEMP\fix-scroll-check.mjs` then `node $env:TEMP\fix-scroll-check.mjs http://localhost:3000`.)*Save the baseline counts: `overflow: hidden` Tab-focus scrolls, broken `position: sticky` elements, missing `scrollbar-gutter: stable` / modal navbar shifts, scroll-chaining containers missing `overscroll-behavior: contain`, and `<dialog>` roots using `overflow: hidden`.### 1B. Static source scan```bashG='-g *.{tsx,jsx,ts,js,vue,svelte,astro,html,css} -g !node_modules -g !.next -g !dist'# 1. overflow: hidden on page wrappers, dialogs, cards, and animated panels (check if overflow-clip fits)rg -n '\b(overflow-hidden|overflow-x-hidden|overflow-y-hidden)\b|overflow(-x|-y)?:\s*hidden' $G .# 2. Sticky elements (check every ancestor above them for overflow-hidden / overflow-x-hidden / overflow-auto)rg -n '\bsticky\b|position:\s*sticky' $G .# 3. Scrollable drawers, sidebars, modals, and panels potentially missing overscroll-containrg -n '\b(overflow-y-auto|overflow-auto|overflow-y-scroll)\b' $G . | rg -v 'overscroll-contain'# 4. Modal scroll locks mutating html/body overflow (causes 15px scrollbar jump + restyle stall)rg -n '(documentElement|body)\.style\.(overflow|overflowY|paddingRight)\s*=' $G .# 5. Check whether scrollbar-gutter: stable is declared in global CSSrg -n 'scrollbar-gutter\s*:\s*stable' -g '*.css' -g '!node_modules' -g '!.next' -g '!dist' .```---## Step 2 — Fix each class of bug cleanly### 2.1 `overflow: hidden` silently scrolling crooked on Tab focusMost developers do not realize `overflow: hidden` is still a **programmatically scrollable** container. If an input, button, or animated child sits near or past the edge of an `overflow: hidden` card, sheet, or fold, pressing `Tab` (or calling `.focus()`) causes the browser to scroll that container to reveal it — leaving the card permanently offset with no scrollbar to get back.- **Fix:** Replace `overflow: hidden` (`overflow-hidden`) with **`overflow: clip`** (`overflow-clip`) on:  - Cards, panels, and rounded frames  - Collapsible accordions and grid-row folds (`grid-template-rows: 0fr -> 1fr`, paired with `inert` when closed so Tab skips hidden controls completely)  - `<dialog>` and drawer/sheet roots  - Page wrappers (`overflow-x-clip`)- `overflow: clip` forbids all scrolling — user **and** programmatic — so focusing can never displace the content.### 2.2 Ancestors silently breaking `position: sticky`Any ancestor between a `position: sticky` element and the viewport that has `overflow: hidden`, `overflow: auto`, or `overflow: scroll` (even only on `overflow-x: hidden`!) creates a new scroll container and stops `position: sticky` from sticking to the window.- **Fix:** Replace `overflow-x: hidden` (`overflow-x-hidden`) on `<main>`, layout shells, and page wrappers with **`overflow-x: clip`** (`overflow-x-clip`). Unlike `hidden`, `clip` does not create a scroll container, so every sticky header, sidebar, and table header works as expected.### 2.3 Scrollbar disappear shifting the navbar 15px sidewaysOn Windows, Linux, and macOS with scrollbars enabled, switching between a short route and a long route — or opening a modal that hides the page scrollbar — widens the viewport by ~15px and jolts the entire header and centered layout sideways.- **Fix (2 parts):**  1. Reserve the gutter once in global CSS:     ```css     html {       scrollbar-gutter: stable;     }     ```  2. Stop toggling `document.documentElement.style.overflow = 'hidden'` when opening dialogs or drawers. Instead, put `overscroll-behavior: contain` on the scrollable overlay content and prevent `wheel` / `touchmove` on the backdrop so the background page stays locked with zero layout reflow and zero horizontal jump.### 2.4 Scroll chaining bleeding behind modals, sidebars, and chat drawersWhen a visitor scrolls to the top or bottom of a scrollable modal, sidebar, dropdown list, or chat transcript, the browser chains the remaining wheel/touch momentum straight into the main page behind it.- **Fix:** Add **`overscroll-behavior: contain`** (`overscroll-contain`) to every independent scrollable container (`overflow-y-auto`, drawers, dialogs, sidebars, command palettes, code viewers, dropdown menus).### 2.5 `showModal()` jerking off-screen sheets & popping mobile keyboardsCalling `dialog.showModal()` automatically focuses the first focusable control inside the dialog. If the sheet slides in from off-screen inside an `overflow: hidden` root, the browser scrolls the container to that control mid-entrance (jerking the sheet) and pops the software keyboard on phones.- **Fix:**  - Use `overflow: clip` (`overflow-clip`) on the dialog/sheet root.  - Put `tabIndex={-1}` on the dialog panel itself and focus the panel on open (`panelRef.current?.focus({ preventScroll: true })`) instead of auto-focusing the first `<input>`.  - Restore focus cleanly to the trigger button when closing via `Escape` or backdrop click.### 2.6 Clipped dropdowns/popovers & fighting auto-scroll- **Clipped dropdowns:** Render popovers, tooltips, and select listboxes in a portal (or outside `overflow: hidden` / `overflow: clip` cards) with viewport collision padding so menus are never sliced in half by a parent card.- **Auto-scroll fighting the user (chat / log streams):** Only pin to bottom while the user is already near the bottom, and disengage auto-scroll as soon as a recent user `wheel`, `touchmove`, `keydown`, or scrollbar interaction scrolls upward (never treat content height shrinking as a user scroll-up).---## Step 3 — Verify every fix in Chromium1. Run your project's typecheck and build.2. Re-run the verifier across the same routes:   ```bash   node /tmp/fix-scroll-check.mjs http://localhost:3000 --routes /,/dashboard,/settings   ```3. Confirm:   - `0` `overflow: hidden` containers that scroll on Tab/focus.   - `0` `position: sticky` elements killed by an `overflow: hidden` ancestor.   - `0px` navbar/viewport shift when opening modals or switching routes.   - `0` independent scroll regions missing `overscroll-behavior: contain`.---## Step 4 — Report (keep it tight)```text/fix-scroll — verified in Chromium  overflow:hidden Tab-focus traps:     4 → 0  (switched to overflow-clip + inert)  Broken position:sticky elements:     2 → 0  (wrapper overflow-x-hidden → overflow-x-clip)  Modal scrollbar navbar shift:     15px → 0px (scrollbar-gutter: stable + overlay lock)  Scroll-chaining containers:          7 → 0  (added overscroll-contain)  Dialog roots with overflow:hidden:   2 → 0  (overflow-clip + panel focus)Files changed:- src/app/globals.css — added html { scrollbar-gutter: stable }- src/app/layout.tsx — replaced overflow-x-hidden with overflow-x-clip- src/components/Accordion.tsx — overflow-clip + inert on collapsed content- src/components/Sidebar.tsx — added overscroll-contain on scrollable navNot checked:- Authenticated admin routes behind /admin```
/skills/fix-scroll.md
The full skill in plain markdown with YAML frontmatter. Drop into .claude/skills, .cursor/rules or .agents/skills.
/skills/fix-scroll-check.mjs
Standalone Node verifier for /fix-scroll. Runs locally with --json and --fail flags.

Templates

Every Hairline template passes these out of the box

65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.