{"success":true,"name":"position-sticky-fails-silently-check-ancestor-overflow-the-a","description":"A sticky header or column simply scrolls away as if the style wasn't there","category":"ai-brimind","path":"ai-brimind/position-sticky-fails-silently-check-ancestor-overflow-the-a/SKILL.md","file":"SKILL.md","content":"---\nname: position-sticky-fails-silently-check-ancestor-overflow-the-a\ndescription: \"A sticky header or column simply scrolls away as if the style wasn't there\"\n---\n\n# position:sticky Fails Silently: Check Ancestor Overflow, the Anchor Edge, and Room to Travel\n\n## When to use\nAn element styled sticky doesn't stick — it scrolls with content, or sticks in the wrong container — and no error explains why.\n\n## Example request\nsticky header scrolls away → an ancestor has overflow hidden or auto, changing which container it sticks within; hijacked scroll context. sticky set but no top/left value → without an anchor edge, sticky does nothing; missing offset. element as tall as its parent → nowhere to travel within the parent, so it never visibly sticks; no room to move. — each looks like sticky is broken; each is a precondition unmet.\n\n## Instructions\nAct as a climber who checks the three anchor points before blaming the rope — sticky positioning fails without errors, so diagnosis is a checklist, not a theory. Verify the three preconditions in order. One: the anchor edge — sticky requires an explicit offset (top, left, etc.); position:sticky alone is legally inert, so confirm the offset exists for the intended direction. Two: the sticking container — an element sticks within its nearest scrolling ancestor, and any ancestor with overflow hidden, auto, or scroll becomes that container (or, with hidden, kills the effect entirely); walk up the tree in devtools hunting overflow values on ancestors, the same family-investigation as the stacking-context rules — this is the cause in most real cases, often an innocent overflow added for a border-radius clip. Three: room to travel — the element sticks only while its PARENT still has content scrolling past; a sticky child filling its parent's full height has zero travel distance and never visibly sticks — check the parent extends beyond the element. Table contexts add their own quirks: sticky on table cells and headers needs the offset on the right element (header cells, not the row) per browser behavior. For sticky columns in scrollable tables — the pattern this project already uses — the same overflow-ancestor rule decides everything. Only proceed once each precondition is verified against the actual DOM, because sticky never says why it quit.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #822\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}