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

Cross-Origin iFrame Bug #1982

Closed
mgreminger opened this issue May 23, 2023 · 4 comments
Closed

Cross-Origin iFrame Bug #1982

mgreminger opened this issue May 23, 2023 · 4 comments
Assignees
Labels

Comments

@mgreminger
Copy link
Contributor

Description

When a page with a math-field element is embedded in an iframe on a site at a different origin, keyboard input into the math-field does not work and generates console errors. I've created a minimum reproduction on code-pen here. The issue is also shown in the screen recording below:

Screen.Recording.2023-05-23.at.9.58.10.AM.mov

MathLive version
0.94.3

Operating System
All

Browser
All

@arnog arnog closed this as completed in 45e7f9b May 23, 2023
@arnog arnog self-assigned this May 23, 2023
@arnog arnog added the bug label May 23, 2023
@arnog
Copy link
Owner

arnog commented May 23, 2023

I'm not sure I have a complete fix. AFAICT the CodePen you have cannot fully work, since the cross-origin policy correctly prevents access between the frame and the host document. However, I have implemented some resilience so that no runtime error will be generated. The virtual keyboard will not be functional in the embedded frame in this situation, though.

@mgreminger
Copy link
Contributor Author

Thanks for the fix, I'll try it out. Yes, you're correct, the virtual keyboard needs same origin to work. I just need the physical keyboard input to work. I'll attempt to create a test for this as well.

@mgreminger
Copy link
Contributor Author

Yes, that did the trick, thanks! I just submitted a pull request to add a cross-origin iframe test that uses the physical keyboard. This is in addition to the current same-origin iframe test that uses the virtual keyboard.

arnog pushed a commit that referenced this issue May 23, 2023
* tests: add cross-origin iframe test

Also, move iframe tests to their own page to prevent nested iframes. same-origin iframe test uses virtual keyboard and cross-origin iframe test uses phyiscal test

* tests: fix cross-origin iframe test
@arnog
Copy link
Owner

arnog commented May 23, 2023

OK, great. Thanks for the tests!

helio3197 pushed a commit to helio3197/mathlive that referenced this issue May 26, 2023
helio3197 pushed a commit to helio3197/mathlive that referenced this issue May 26, 2023
* tests: add cross-origin iframe test

Also, move iframe tests to their own page to prevent nested iframes. same-origin iframe test uses virtual keyboard and cross-origin iframe test uses phyiscal test

* tests: fix cross-origin iframe test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants