yari icon indicating copy to clipboard operation
yari copied to clipboard

Playground doesn't `allow-modals`

Open ericrav opened this issue 4 months ago • 0 comments

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: https://github.com/mdn/yari/blob/55dcf6fe840f9d9b883e1979e86810519f92a43b/client/src/playground/index.tsx#L391

Validations

ericrav avatar Oct 23 '24 21:10 ericrav