segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

SelectMenu popover at the bad position #1377

Closed leosheecool closed 2 years ago

leosheecool commented 2 years ago

Hello there,

I submit this issue because on a project I need to use the SelectMenu component and when I click on the button to open the popover it does not take the position that I pass in props. (I used the documentation code sample)

image

Can you help me to resolve that issue please ?

brandongregoryscott commented 2 years ago

Hi @leosheecool - what version of Evergreen are you using? I believe this bug was introduced in v6.5.2 and resolved in v6.6.1. Try upgrading to the latest version and let me know if this issue is still present.

leosheecool commented 2 years ago

Hi @brandongregoryscott I have the latest version the v6.6.2 so that's why it's weird

brandongregoryscott commented 2 years ago

My apologies - I misread the issue and I see that you are manually trying to set the position prop, which isn't exactly the same issue that was introduced in v6.5.2.

Would you mind providing a code sample, or ideally, a sandbox to reproduce the issue? I spun up a demo sandbox with a simple SelectMenu that changes its position based on what value is selected, and I'm not seeing the same issue: https://codesandbox.io/s/evergreen-issues-1377-5ne1f

Note that the Positioner handles this heavy lifting and it can't always respect the requested position if there's too little viewport space to render the component. You can test that by reducing the amount of bottom margin on the Paragraph in the demo.

Edit: It's also worth noting that it does not accept Position.LEFT or Position.RIGHT, which should be reflected in the type definition.