You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[7.x] [Security Solution][Resolver] Update the resolver element ref on scroll events if the position of the element has changed within the page (#72461) (#72790)
* Any time the DOM node changes (to something other than `null`) recalculate the DOMRect and set it (which will cause it to be returned from the hook.
300
+
* This effect re-runs when the DOM node has changed.
301
+
*/
302
+
useEffect(()=>{
303
+
if(currentNode!==null){
304
+
// When the DOM node is received, immedaiately calculate its DOM Rect and return that
305
+
setRect(currentNode.getBoundingClientRect());
306
+
}
307
+
},[currentNode]);
308
+
309
+
/**
310
+
* When scroll events occur, recalculate the DOMRect. DOMRect represents the position of an element relative to the viewport, so that may change during scroll (depending on the layout.)
311
+
* This effect re-runs when the DOM node has changed.
312
+
*/
313
+
useEffect(()=>{
314
+
// the last scrollX and scrollY values that we handled
0 commit comments