mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[Flare] More fixes for getAbsoluteBoundingClientRect (#15746)
This commit is contained in:
Vendored
+11
-6
@@ -459,12 +459,17 @@ function getAbsoluteBoundingClientRect(
|
||||
// are fixed position, using offsetParent node for a fast-path.
|
||||
// We need to check both as offsetParent accounts for both
|
||||
// itself and the parent; so we need to align with that API.
|
||||
// If these all pass, we can stop traversing the tree.
|
||||
if (
|
||||
(scrollLeft !== 0 || scrollTop !== 0) &&
|
||||
(isNodeFixedPositioned(parent) || isNodeFixedPositioned(node))
|
||||
) {
|
||||
break;
|
||||
// If these all pass, we can skip traversing the relevant
|
||||
// node and go directly to its parent.
|
||||
if (scrollLeft !== 0 || scrollTop !== 0) {
|
||||
if (isNodeFixedPositioned(parent)) {
|
||||
node = ((parent: any): Node).parentNode;
|
||||
continue;
|
||||
}
|
||||
if (isNodeFixedPositioned(node)) {
|
||||
node = parent;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
offsetX += scrollLeft;
|
||||
offsetY += scrollTop;
|
||||
|
||||
@@ -1232,7 +1232,7 @@ describe('Event responder: Press', () => {
|
||||
document.firstElementChild.scrollTop = 1000;
|
||||
const updatedCoordinatesInside = {
|
||||
pageX: coordinatesInside.pageX,
|
||||
pageY: coordinatesInside.pageY + 100,
|
||||
pageY: coordinatesInside.pageY + 1100,
|
||||
};
|
||||
ref.current.dispatchEvent(
|
||||
createEvent('pointerdown', updatedCoordinatesInside),
|
||||
|
||||
Reference in New Issue
Block a user