Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /document-picture-in-picture/pip-receives-focus.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Test that the document Picture in picture window receives system focus</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<body>
<script>
promise_test(async (t) => {
await test_driver.bless('request PiP window');
const pipWindow = await documentPictureInPicture.requestWindow();
if (!pipWindow.document.hasFocus()) {
await new Promise(resolve => pipWindow.onfocus = resolve);
}
assert_true(pipWindow.document.hasFocus(), 'PiP has focus');
pipWindow.close();
}, 'PiP recieves system focus after being opened');
</script>
</body>