floating-ui / react-popper

🍿⚛Official React library to use Popper, the positioning library
https://popper.js.org/react-popper/
MIT License
2.5k stars 226 forks source link

Top padding for `preventOverflow` not respected in macOS Safari & iOS #422

Open goleary opened 3 years ago

goleary commented 3 years ago

I have a popper controlled tooltip and I'm trying to create add top padding (50px in this example) to the overflow prevention.

Here you can see even though I've turned on the altAxis overflow prevention. image

this is the config I'm using

  const { styles, attributes } = usePopper(range, popperElement, {
    placement: 'top',
    modifiers: [
      {
        name: 'preventOverflow',
        options: {
          // TODO: figure out why top padding isn't being respected
          altAxis: true,
          padding: {
            top: 50,
            left: 8,
            right: 8,
            bottom: 8,
          },
        },
      },
    ],
  });

Reproduction demo

https://stackblitz.com/edit/react-popper-overflow?file=Tooltip.tsx

What is the expected behavior?

I'd like the tooltip to respect the top padding as specified in options.

What went wrong?

Top padding not respected.

I know the option is working because the "main" axis padding is respected.

Packages versions

goleary commented 3 years ago

I did a bit more playing around and this bug seems to be environment/browser dependent.

You can see for yourself by using this link (live version of the provide minimal repro above), selecting text & scrolling down until the tooltip should flip.

No issue

Issue Present

acgblogs commented 2 years ago

thanks