Skip to content

Flip Modifiers Not Applied #749

Open
@athielen2

Description

@athielen2

Describe the bug

When passing popperConfig into an Overlay component, the flip modifiers are not applied.

To Reproduce

Steps to reproduce the behavior:

  1. Create an Overlay component with a popperConfig that has flip modifiers set
  2. Observe that those modifiers are not applied

Expected behavior

Expected that the modifiers passed in (ex: behavior) would be applied to the underlying popper instance

Screenshots

If applicable, add screenshots to help explain your problem.

Environment (please complete the following information)

  • Operating System: [e.g. macOS]
    MacOS
  • Browser, Version [e.g. Chrome 74]
    Chrome 78.0.3904.108
  • react-overlays Version [e.g. 2.0.0]
    2.1.0

Additional context

I see in Overlay.js that the preventOverflow modifiers are spread onto the popper config. Is this intentional?

const { styles, arrowStyles, ...popper } = usePopper(target, rootElement, {
    ...popperConfig,
    placement: placement || 'bottom',
    enableEvents: props.show,
    modifiers: {
      ...modifiers,
      preventOverflow: {
        padding: containerPadding || 5,
        ...modifiers.preventOverflow,
      },
      arrow: {
        ...modifiers.arrow,
        enabled: !!arrowElement,
        element: arrowElement,
      },
      flip: {
        enabled: !!flip,
        ...modifiers.preventOverflow,
      },
    },
  });

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