You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Safari, if <math-field> is unmounted while still focused (e.g. closing modal via backdrop), reopening it triggers: TypeError: undefined is not an object (evaluating 'this.mathfield.options').
Rewriting it to use optional chaining (this.mathfield?.options?.defaultMode ?? "math") avoids the issue, but this feels like a temporary fix. I'd like to know if there's a better solution. (Or ways to workaround it on the client side.)
Environment
Browser: Safari (macOS)
MathLive: 0.108.3
React: 19.2.4
The repro uses conditional rendering (mount/unmount) in a modal.
Summary
In Safari, if
<math-field>is unmounted while still focused (e.g. closing modal via backdrop), reopening it triggers: TypeError: undefined is not an object (evaluating 'this.mathfield.options').error.mov
Reproduction
Steps to reproduce
Causes and Workarounds
In Safari, it seems
blur()is called afterdispose().Since
this.mathfieldbecomesundefined, it throws a TypeError when trying to readthis.mathfield.options.defaultMode.mathlive/src/editor-model/model-private.ts
Line 498 in 8342e1c
Rewriting it to use optional chaining (
this.mathfield?.options?.defaultMode ?? "math") avoids the issue, but this feels like a temporary fix. I'd like to know if there's a better solution. (Or ways to workaround it on the client side.)Environment