From 6ee75da164170e77bbff2b2ea8b63bfc129eba3b Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Thu, 18 Jun 2026 12:14:08 -0400 Subject: [PATCH] Work around issue with Safari 26 not processing math inside otherwise empty containers with overflow: auto. (mathjax/MathJax#3579) --- ts/ui/lazy/LazyHandler.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ts/ui/lazy/LazyHandler.ts b/ts/ui/lazy/LazyHandler.ts index 6bcf48afb..73c53ea93 100644 --- a/ts/ui/lazy/LazyHandler.ts +++ b/ts/ui/lazy/LazyHandler.ts @@ -32,6 +32,7 @@ import { HTMLHandler } from '../../handlers/html/HTMLHandler.js'; import { SpeechMathItem } from '../../a11y/speech.js'; import { handleRetriesFor } from '../../util/Retries.js'; import { OptionList } from '../../util/Options.js'; +import { StyleJson } from '../../util/StyleJson.js'; /** * Add the needed function to the window object. @@ -388,6 +389,19 @@ export function LazyMathDocumentMixin< */ protected lazySet: LazySet = new Set(); + /** + * Extra styles for lazy nodes. + */ + public static lazyStyles: StyleJson = { + 'mjx-lazy': { + // + // Needed for Safari 26 when the math appears inside an othewise empty + // node with overflow: auto. See issue #3579. + // + display: 'inline-block', + }, + }; + /** * Augment the MathItem class used for this MathDocument, * then create the intersection observer and lazy list, @@ -400,6 +414,7 @@ export function LazyMathDocumentMixin< */ constructor(...args: any[]) { super(...args); + this.addStyles((this.constructor as typeof BaseClass).lazyStyles); // // Use the LazyMathItem for math items //