-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Spec
https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps (the 5th entry under focusing step 1)
If new focus target is a browsing context container with a non-null nested browsing context
Let new focus target be the browsing context container's nested browsing context's active document.
https://www.w3.org/TR/html5/editing.html#focus
When a child browsing context is focused, its browsing context container must also have focus.
Test
Required changes
In lib/jsdom/living/helpers/focusing.js
:
exports.isFocusableAreaElement
should return true iframe element. Could use something like:
if (elImpl instanceof elImpl._ownerDocument._defaultView.HTMLIFrameElement) {
return true;
}
(using the defaultView's HTMLIFrameElement constructor means that if nested browsing contexts are ever made separate / sandboxed, the check will still work)
In lib/jsdom/living/nodes/HTMLElement-impl.js
:
focus
needs to recursively checkownerDocument.defaultView.parent
and invoke.focus()
on any parentHTMLIFrameElement
:
if (this._ownerDocument._defaultView._frameElement) {
this._ownerDocument._defaultView._frameElement.focus();
}
blur
shouldn’t need to change, I don’t think. When a focusable element inside an iframe is blurred, the iframe element itself (the browsing context container) is still theactiveElement
of its parent.
Metadata
Metadata
Assignees
Labels
No labels