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

Example unable to be used for ScreenOrientation.lock #12386

Open
danielhjacobs opened this issue Dec 28, 2024 · 5 comments
Open

Example unable to be used for ScreenOrientation.lock #12386

danielhjacobs opened this issue Dec 28, 2024 · 5 comments
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@danielhjacobs
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock

What specific section or headline is this issue about?

Examples

What information was incorrect, unhelpful, or incomplete?

Clicking fullscreen prints TypeError: Disallowed by permissions policy

Clicking Lock prints SecurityError: Failed to execute 'lock' on 'ScreenOrientation': The window is sandboxed and lacks the 'allow-orientation-lock' flag.

What did you expect to see?

Usable example

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@danielhjacobs danielhjacobs added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 28, 2024
@danielhjacobs danielhjacobs changed the title Example unable to be used Example unable to be used for ScreenOrientation.lock Dec 28, 2024
@skyclouds2001
Copy link
Contributor

skyclouds2001 commented Dec 29, 2024

I think we should find some ways to specified sandbox attribute on iframe with live examples...

@wbamberg
Copy link
Collaborator

Does param $6 of the macro: https://github.com/mdn/yari/blob/main/kumascript/macros/EmbedLiveSample.ejs#L13 help here?

@skyclouds2001
Copy link
Contributor

I think we should find some ways to specified sandbox attribute on iframe with live examples...

No, for this case, a sandbox="allow-orientation-lock" flag is required for this sample

@danielhjacobs
Copy link
Contributor Author

danielhjacobs commented Jan 2, 2025

So would the change be this (in yari)?

var allowedFeatures = $6;
+const sandboxAttributes = $7;

Can also be var just to match the other variables but const is modern.

-%> sandbox="allow-same-origin allow-scripts"></iframe></div><%
+%> sandbox="allow-same-origin allow-scripts<%= $7 ? ' ' + $7 : '' %>"></iframe></div><%

Then param $7 can be set to allow-orientation-lock and param $6 can be used for fullscreen.

@caugner
Copy link
Contributor

caugner commented Jan 3, 2025

So would the change be this (in yari)?

Please note that the macros are now rendered by rari, see: https://github.com/mdn/rari/blob/03fc5598f482df7992ad81c6d25bb0a8c0f17dec/crates/rari-doc/src/templ/templs/mod.rs#L106

Nevertheless I will move this issue to yari, because we might solve this with upcoming Playground changes.

@caugner caugner transferred this issue from mdn/content Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

No branches or pull requests

4 participants