Fix MathJax pop-up appearing at bottom of screen

Closes #2174
This commit is contained in:
Damien Elmes 2022-11-03 11:47:31 +10:00
parent a0e403c3dd
commit ef933f9975

View File

@ -47,6 +47,7 @@ function positionFloating({
floating: FloatingElement, floating: FloatingElement,
): Promise<void> { ): Promise<void> {
const middleware: Middleware[] = [ const middleware: Middleware[] = [
// the .shift() lines below expect flip() to be first
flip(), flip(),
offset(offsetArg), offset(offsetArg),
shift({ padding: shiftArg }), shift({ padding: shiftArg }),
@ -63,9 +64,11 @@ function positionFloating({
if (Array.isArray(placement)) { if (Array.isArray(placement)) {
const allowedPlacements = placement; const allowedPlacements = placement;
// flip() is incompatible with autoPlacement
middleware.shift();
middleware.push(autoPlacement({ allowedPlacements })); middleware.push(autoPlacement({ allowedPlacements }));
} else if (placement === "auto") { } else if (placement === "auto") {
middleware.shift();
middleware.push(autoPlacement()); middleware.push(autoPlacement());
} else { } else {
computeArgs.placement = placement; computeArgs.placement = placement;