Skip to content

Allow Floating Strategy to be Configurable for Popover #1504

Open
@sean-redteam

Description

@sean-redteam
  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Summary

Describe how it should work, and provide examples of the solution, which might include screenshots or code snippets.

Hello and thanks for providing this reference implementation for Flowbite. I have a use case for the Popover that is not currently covered but can easily be added.

I am using a Popover component inside of a parent which is overflow: auto set. This means the popover is cut off. See screen shot.

Screenshot 2024-10-25 at 11 57 19 AM

This is due to @floating-ui/react using position: absolute by default.

The good news is that useFloating has a strategy prop that can be passed to override this if necessary. In scenarios like mine, position: fixed is needed. I did some testing, and it works well. See screen shot.

Screenshot 2024-10-25 at 11 59 55 AM

The popover is still attached to the reference element and scrolls along with it.

Context

What are you trying to accomplish? How is your use case affected by not having this feature?

Popover should be updated to accept a strategy prop of type:

strategy?: 'absolute' | 'fixed';

This is passed to useFloating from the @floating-ui/react library.

Without this feature, popovers are cut off in parents that have overflow other than visible.

I'm happy to create a PR for this if it will help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIt is not a bug or an enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions