-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1690607 [wpt PR 27461] - Portals: focus() inside portal should ch…
…ange active element, a=testonly Automatic update from web-platform-tests Portals: focus() inside portal should change active element Allows a portal document's activeElement to update when focus is called. Note that focus events won't be dispatched as the portal doesn't get page focus, and the portal WebContents isn't set as the focused WebContents (with the exception of orphaned portals). Updating the activeElement also means an autofocused element inside a portal will receive focus when the portal is activated. More discussion here: WICG/portals#257 Change-Id: If67be1f424114653983b473a80c515337d49596a Bug: 1059404 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566072 Commit-Queue: Adithya Srinivasan <adithyaschromium.org> Reviewed-by: Lucas Gadani <lfgchromium.org> Reviewed-by: Jeremy Roman <jbromanchromium.org> Reviewed-by: Alex Moshchuk <alexmoschromium.org> Reviewed-by: David Trainor <dtrainorchromium.org> Cr-Commit-Position: refs/heads/master{#853647} -- wpt-commits: a507854e826d126010758ba44847d1b67fb29c01 wpt-pr: 27461 UltraBlame original commit: 7e6160586f3c29315b5b2267b293ecbdfefd4324
- Loading branch information
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
testing/web-platform/tests/portals/resources/focus-page-with-autofocus.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<button id="one">one</button> | ||
<button id="two" autofocus>two</button> | ||
<button id="three">three</button> | ||
<script> | ||
function messageHandler(e) { | ||
if (e.data === 'check-active-element') { | ||
let autofocusedButton = document.querySelector('#two'); | ||
e.source.postMessage(document.activeElement === autofocusedButton); | ||
} | ||
} | ||
|
||
window.portalHost.onmessage = messageHandler; | ||
window.onportalactivate = e => { | ||
let portal = e.adoptPredecessor(); | ||
portal.onmessage = messageHandler; | ||
document.body.appendChild(portal); | ||
} | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
testing/web-platform/tests/portals/resources/focus-page-with-x-origin-iframe.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters