Skip to content

Sticky Element does not stick when within a scrollable div #289

@scion976

Description

@scion976

I'm submitting a ...

  • bug report
  • [x ] feature request
  • support request

If you're reporting a bug, please provide a minimal demonstration of the problem

When wrapped within an enclosing div with a max height and scrollbar the Sticky components no longer stick.

https://codesandbox.io/embed/react-sticky-sample-project-0yz7t

What is the current behavior?

The sticky component no longer sticks

What is the expected or desired behavior?

The sticky component sticks on scroll

Why do you want this? What use case do you have?

What is your environment?

  • Version: 75.0.3770.100
  • Browser: Chrome

Is there anything else I should know?

I believe the issue is that the sticky component does not capture the scroll events of the parent div which creates the scrollable area. Adding an additional (optional) prop taking in the ref of the parent should allow the component to bind to the parent's scroll event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions