Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent errors when embedded in iframe #1964

Merged
merged 2 commits into from
May 17, 2023
Merged

Conversation

mgreminger
Copy link
Contributor

@mgreminger mgreminger commented May 12, 2023

After switching EngineeringPaper.xyz over to mathlive from mathquill, I discovered that my blog posts with EngineeringPaper.xyz iframe embeds were no longer functional since MathLive fields are not functional when embedded in an iframe on an outer page that does not itself contain a math field.

See an example page here with mathlive fields in an iframe (scroll down to see the iframe).

Here's the same EngineeringPaper.xyz sheet rendered outside of an iframe using MathLive.

This is the blog page rendered correctly (falling back to the MathQuill implementation).

The issue was the _boundingRect static member of the VritualKeyboardProxy class being used before being initialized. This change initializes the _boundingRect value, which fixes the iframe issue.

I also added a Playwright test to test the virtual keyboard targeting a mathfield in an iframe to ensure that this change does not introduce a regression with using the virtual keyboard to target a math field in an iframe.

MathLive fields were not functional when embedded in an iframe on a outer page that did not contain a math field.

Also, added tests to test virtual keyboard targeting a mathfield in an iframe.
@arnog
Copy link
Owner

arnog commented May 17, 2023

Oops. Sorry about that. Good catch, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants