From ef933f997584cac743afcb77579d1dc1506dcbee Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 3 Nov 2022 11:47:31 +1000 Subject: [PATCH] Fix MathJax pop-up appearing at bottom of screen Closes #2174 --- ts/sveltelib/position/position-floating.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/sveltelib/position/position-floating.ts b/ts/sveltelib/position/position-floating.ts index 9094f475f..43bd84637 100644 --- a/ts/sveltelib/position/position-floating.ts +++ b/ts/sveltelib/position/position-floating.ts @@ -47,6 +47,7 @@ function positionFloating({ floating: FloatingElement, ): Promise { const middleware: Middleware[] = [ + // the .shift() lines below expect flip() to be first flip(), offset(offsetArg), shift({ padding: shiftArg }), @@ -63,9 +64,11 @@ function positionFloating({ if (Array.isArray(placement)) { const allowedPlacements = placement; - + // flip() is incompatible with autoPlacement + middleware.shift(); middleware.push(autoPlacement({ allowedPlacements })); } else if (placement === "auto") { + middleware.shift(); middleware.push(autoPlacement()); } else { computeArgs.placement = placement;