Position “sticky” not working in ReactJS app, and no “overflow” attribute specified in parent

Keywords: html css reactjs sticky

Question: 

I'm building a React app, and I'm having a problem with position: sticky in my story-header element. I already checked the parent styles and there's no overflow: hidden attribute-value.

HTML

<div className='StoryList' >
    <div className='story-header'></div>
</div>

CSS - Stylesheet

.App {
    width: 100%;
    overflow: visible;
}
.StoryList {
    position: relative;
    margin: 0;
    width: 100%;
}
.story-header {
    width: 100%;
    top: -20px;
    height: 50px;
    left: 0;
    background-color: lightgray;
    position: sticky;
    z-index: 1;
}

Why is the story-header sliding above the top?

Answers: 

I'm not sure that I understood you correctly, but it works as it should. I've tried it in pure html/css and it's working. Check my code, buddy:

.App {
    width: 100%;
    height: 200vh;
    overflow: visible;
}

.StoryList {
    background: #000;
    height: 40vh;
    position: fixed; // you can comment it out, I'm not sure what would you like to have
    margin: 0;
    width: 100%;
}

.story-header {
    width: 100%;
    top: -20px;
    height: 50px;
    left: 0;
    background-color: lightgray;
    position: sticky;
    z-index: 1;
}