mirror of
https://github.com/discourse/discourse.git
synced 2025-06-11 05:53:49 +08:00
FIX: ensures rects is present before using it (#11930)
I don't have a clear reproduction ATM, but I imagine that in fast tests element can get destroyed before we get to use it.
This commit is contained in:
@ -883,16 +883,20 @@ export default Component.extend(
|
|||||||
wrapper.style.height = `${height}px`;
|
wrapper.style.height = `${height}px`;
|
||||||
if (placementStrategy === "fixed") {
|
if (placementStrategy === "fixed") {
|
||||||
const rects = this.element.getClientRects()[0];
|
const rects = this.element.getClientRects()[0];
|
||||||
const bodyRects = body && body.getClientRects()[0];
|
|
||||||
wrapper.style.position = "fixed";
|
if (rects) {
|
||||||
wrapper.style.left = `${rects.left}px`;
|
const bodyRects = body && body.getClientRects()[0];
|
||||||
if (topPlacement && bodyRects) {
|
|
||||||
wrapper.style.top = `${rects.top - bodyRects.height}px`;
|
wrapper.style.position = "fixed";
|
||||||
} else {
|
wrapper.style.left = `${rects.left}px`;
|
||||||
wrapper.style.top = `${rects.top}px`;
|
if (topPlacement && bodyRects) {
|
||||||
}
|
wrapper.style.top = `${rects.top - bodyRects.height}px`;
|
||||||
if (isDocumentRTL()) {
|
} else {
|
||||||
wrapper.style.right = "unset";
|
wrapper.style.top = `${rects.top}px`;
|
||||||
|
}
|
||||||
|
if (isDocumentRTL()) {
|
||||||
|
wrapper.style.right = "unset";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user