Closed dengribar closed 1 year ago
@dengribar Is this reproducible in a CodeSandbox (or can you provide your test code that's failing)? https://codesandbox.io/s/create-react-app-evergreen-starter-ts-3q99w
The code that is subscribing to resize
/scroll
events has been there for a bit now (but you're right, we probably shouldn't be passing update
directly as event handlers), but may be being hit in a different situation from the fix for the Tooltip flickering https://github.com/segmentio/evergreen/pull/1550.
Better late than never, but I was able to reproduce the bug that happens in our automated tests:
https://codesandbox.io/s/evergreen-ui-6-12-0-popover-works-fine-on-scroll-ws9xox?file=/src/App.tsx
Not exactly, though, since on v6.12.0 our automated tests work fine, but the sandbox example still doesn't work.
On the other hand, on v7.0.0, despite the same NaN value for top property
warning, the popover is displayed in an appropriate position:
Anyway, even though v7.0.0 kind of patches the issue somehow, the bug with passing an event
object as prevHeight
param to the update
function (ref) needs to be fixed, and I hope that it will properly patch the issue. Thanks!
This should be fixed in https://github.com/segmentio/evergreen/releases/tag/v7.1.3!
👋 After 6.13.1 update, one of our automated integration tests started failing in the following scenario:
Popover
shows up at the same moment when scrolling takes place which results in thePopover
becoming invisible. After looking into this issue, I've found the following:"scroll"
event here, assigningupdate
function as the event handlerscroll
event happens, we pass anevent
object asprevHeight
param to theupdate
function (ref)hasEntered
isfalse
in theupdate
function, then we calculateheight
asMath.max(number, Object)
, which results inNaN
(ref)setDimensions
settingheight
andtop
asNaN
making thePopover
disappear from screen (ref)I'm pretty sure that
height = Math.max(number, Object) // NaN
was not intentional, and seems like a bug to me.Console output