NEW278553
iframe's document not focusing when .focus() is called
https://bugs.webkit.org/show_bug.cgi?id=278553
Summary iframe's document not focusing when .focus() is called
Marcos Caceres
Reported 2024-08-22 22:11:44 PDT
There appears to be an issue with iframes not focusing when .focus() is called on them. Test case: ``` window.onload = async function () { const iframes = document.querySelectorAll("iframe"); for (let iframe of iframes) { await new Promise(resolve => { iframe.onload = resolve; iframe.src = "about:blank"; }); iframe.focus(); console.assert(iframe.contentDocument.hasFocus(), "The iframe is not focused."); } }; ```
Attachments
Radar WebKit Bug Importer
Comment 1 2024-08-29 22:12:11 PDT
Marcos Caceres
Comment 2 2025-02-18 19:18:29 PST
Ahmad Saleem
Comment 3 2026-02-21 10:12:48 PST
(In reply to Marcos Caceres from comment #2) > Test case https://jsfiddle.net/otg682h0/ *** Safari 26.4 Beta *** "iframe1 is not focused after calling focus()" "iframe2 is not focused after calling focus()" "iframe1 is not focused after swapping focus back" "Iframe focus test completed." *** Chrome Canary 147 (147.0.7699.0 (Official Build) canary (arm64) ) *** "Iframe focus test completed." *** Firefox Nightly 149 (20260220092058) *** "Iframe focus test completed."
Note You need to log in before you can comment on or make changes to this bug.