segmentio / evergreen

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

Add window resize handler to update position in Positioner component #1426

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

Overview

Some users are reporting an issue with our Popover component not being visible when they resize their browser windows. This can be reproduced on Storybook or the doc site.

This PR adds a window.resize event listener in the Positioner component which forces it to recalculate its position when the window size changes. It seems to solve the issue (a Popover being hidden when the browser is resized to be smaller), but I'm not sure if there's a cleaner/more efficient way to handle this. (Do I need to use request/cancelAnimationFrame? Should we debounce it?)

Screenshots (if applicable)

Documentation

netlify[bot] commented 2 years ago

✔️ Deploy Preview for evergreen-storybook ready!

🔨 Explore the source changes: 5666ef281a9bd87c6d36b91afb995c55384c5b43

🔍 Inspect the deploy log: https://app.netlify.com/sites/evergreen-storybook/deploys/622b75ff367cbd0009651899

😎 Browse the preview: https://deploy-preview-1426--evergreen-storybook.netlify.app