agentsclimarketplace

Layout stable hover via inset shadow

Skill kjuhwa/skills-hub/skills/design/layout-stable-hover-via-inset-shadow

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill layout-stable-hover-via-inset-shadow

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Replace transform-based hover effects (translate, scale) with inset box-shadow to avoid layout shifts and horizontal-scrollbar flicker

SKILL.md

2.9 KB, as published. Nobody here has run it

Layout-Stable Hover via Inset Shadow

Transform-based hover effects like transform: translateX(2px) look tasteful on a single button but break lists inside scrollable containers. Each item's hover overflows its parent horizontally, the browser flashes a horizontal scrollbar, which shifts the vertical scrollbar, which moves the hovered item out from under the cursor — flicker loop.

The anti-pattern

.list-item {
  transition: all .2s;
}
.list-item:hover {
  transform: translateX(2px);   /* ← overflows parent */
  box-shadow: 0 0 0 1px var(--accent);
}

Inside a container with bounded width, every hover triggers:

  1. Item moves 2px right
  2. Right edge overflows parent
  3. Browser adds horizontal scrollbar
  4. Vertical scrollbar narrows/moves
  5. Item under cursor is no longer hovered
  6. Scrollbar disappears
  7. Repeat — visible flicker

The fix

Use an effect that doesn't change layout:

.list-item {
  min-width: 0;            /* allow text ellipsis */
  transition: background .2s, box-shadow .2s;   /* explicit, not 'all' */
}
.list-item:hover {
  background: var(--hover-bg);
  box-shadow: inset 2px 0 0 var(--accent);   /* painted inside, no overflow */
}
.list-item-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-container {
  overflow-x: hidden;      /* defense in depth */
}

Key changes:

  • box-shadow: inset paints inside the element's box, so it doesn't add to scroll width.
  • Explicit transition properties (background, box-shadow) instead of all — prevents re-triggering on any unrelated property.
  • overflow-x: hidden on container — defense in depth against future hover changes that forget this rule.
  • min-width: 0 on flex children — required to let text-overflow: ellipsis actually truncate inside a flex layout.

When transforms are still fine

Transform-based hovers are fine when:

  • The item has room to grow (e.g. padding or margin buffers on all sides ≥ transform distance)
  • The container has overflow: visible and doesn't scroll
  • The transform is a scale() at origin center (no edge overflow)

They're only bad inside tight scrollable containers.

Related pitfalls

  • transition: all re-fires on any computed property change — scope transitions explicitly.
  • :active using transform: scale(.98) is usually fine because it's brief and mouse is already held.
  • Animated margin-left/right also causes reflow; stick to inset shadows or absolutely-positioned overlays for decoration.

Gives 0 of the 12 instructions most ui components skills give

Counted across 343 of the 344 authors here whose files we hold, read 2026-08-06

  • Make touch targets at least 44x44 pixelsin 48 of 343, across 17 files
  • Use SVG icons instead of emojisin 39 of 343, across 12 files
  • Ensure minimum color contrast of 4.5:1in 36 of 343, across 9 files
  • provide visible focus rings on interactive elementsin 26 of 343, across 10 files
  • Use semantic color tokens instead of raw hex codesin 26 of 343, across 10 files
  • Generate a design system before codingin 23 of 343, across 6 files
  • Respect prefers-reduced-motion user settingsin 22 of 343, across 6 files
  • use semantic html elementsin 21 of 343, across 14 files
  • use semantic tailwind colorsin 19 of 343, across 6 files
  • Match style to product type and industryin 18 of 343, across 2 files
  • use consistent design tokensin 18 of 343, across 6 files
  • build complex interfaces from composable primitivesin 18 of 343, across 6 files

Said here and by no other author read

  • use inset box-shadow for hover decoration
  • scope transition properties explicitly
  • allow text ellipsis on flex children
  • use background change for hover

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.