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

Playground doesn't allow-modals #12023

Open
3 tasks done
ericrav opened this issue Oct 23, 2024 · 1 comment
Open
3 tasks done

Playground doesn't allow-modals #12023

ericrav opened this issue Oct 23, 2024 · 1 comment
Labels
idle needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. plus:playground

Comments

@ericrav
Copy link

ericrav commented Oct 23, 2024

Summary

Playground examples can't run functions like Window.alert(), Window.confirm(), Window.print() and Window.prompt(), because they require the iframe to allow modals.

URL

https://developer.mozilla.org/en-US/play?id=5LQLRl7WZd5jYDacre%2FTXtVGS%2FhsJouAHE2pExEMRUtnJaPVVd3kHX%2FzTn38Jvoen2uLMbThfw7c7zBU

Reproduction steps

  1. Visit https://developer.mozilla.org/en-US/docs/Web/CSS/@page#examples
  2. Go to examples section & click the "Print Webpage" button in the example
  3. Print dialog does not open, open dev tools and see error that call to print() was ignored

Expected behavior

Examples can successfully demonstrate the relevant web API functionality

Actual behavior

The APIs in the example do not work, and the browser logs the error: Ignored call to 'print()'. The document is sandboxed, and the 'allow-modals' keyword is not set.

Device

Desktop

Browser

Chrome

Browser version

Stable

Operating system

Mac OS

Screenshot

image

Anything else?

I believe this is the line that needs to be updated:

sandbox="allow-scripts allow-same-origin allow-forms"

Validations

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Oct 23, 2024
@caugner caugner changed the title Some playground examples don't work because sandboxed iframes need allow-modals enabled Playground doesn't allow-modals Oct 25, 2024
@mohammednumaan
Copy link

mohammednumaan commented Oct 31, 2024

Hey @caugner @ericrav @Josh-Cena . This issue is relevant. The Live Example in this section is broken too. On pressing the button, the output is always:

image

This is likely due to the allow-modal option missing in the sandbox attribute of the iframe in this file.

The only question I have is, will adding this option have an impact on security?
If possible, can I get assigned to resolve this issue?

@github-actions github-actions bot added the idle label Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. plus:playground
Projects
None yet
Development

No branches or pull requests

3 participants