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

Should trusted iFrames be allowed to request KeyboardLock #40

Closed
joedow-42 opened this issue Mar 28, 2018 · 2 comments
Closed

Should trusted iFrames be allowed to request KeyboardLock #40

joedow-42 opened this issue Mar 28, 2018 · 2 comments

Comments

@joedow-42
Copy link
Contributor

The fullscreen API includes a flag which can be applied to an iFrame which allows code executing in the iFrame context to request fullscreen. Spec: https://fullscreen.spec.whatwg.org/#iframe-fullscreen-flag

Is this something we would want to do as a future extension to the KeyboardLock spec?

The scenario would be a site that hosts a game in an iframe which has the ability to request fullscreen. The game code could also request the set of keyboardkeys it requires while in fullscreen mode. Otherwise the hosting site would have to request Keyboard lock on its behalf.

@garykac
Copy link
Member

garykac commented May 4, 2018

Currently, the API is for top-level browsing contexts only, but we could extend it to allow same origin subframes if there is a need.

@mjbvz
Copy link

mjbvz commented Oct 19, 2019

I believe that VS Code may offer a good use case for a feature like this. We use iframes to power our webview api. Here's an example page structure:

- Top level html for editor
    - iframe from different origin that contains code VS Code controls
        - iframe that contains arbitrary html from extensions

We need a way to intercept and prevent native browser keyboard shortcuts (such as cmd+p for print or cmd+w for close window) even when the user is focused on the iframe. As far as I know, there is no way to do this using existing apis. This currently means that when a user is focused on an iframe, pressing cmd+w ends up closing the entire browser tab instead of just closing the current editor in VS Code

I've also raised this issue against chromium here: https://bugs.chromium.org/p/chromium/issues/detail?id=1016034

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

No branches or pull requests

3 participants