It works in isolation and does nothing in the real page, roughly every time, and the reason is almost always an ancestor rather than the element itself.
.sidebar {
position: sticky;
top: 1rem;
}
/* any of these on an ancestor kills it: */
/* overflow: hidden | auto | scroll */
/* the parent being shorter than the element */
/* a flex parent with align-items: stretch and no height */
The overflow rule is the one that catches everyone, because overflow: hidden is applied casually to clear floats or hide a scrollbar and there is no warning that it disables sticky positioning three levels down. Sticky is also constrained to its parent, so a sidebar in a short container stops moving where that container ends — which reads as a bug and is the specification. Debugging it means walking up the tree in devtools rather than adjusting the element.