Bug 278553
| Summary: | iframe's document not focusing when .focus() is called | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Marcos Caceres <marcosc> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ahmad.saleem792, webkit-bug-importer |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://jsfiddle.net/3249g6pw/1/ | ||
| Bug Depends on: | |||
| Bug Blocks: | 268516 | ||
Marcos Caceres
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/134992720>
Marcos Caceres
Test case https://jsfiddle.net/otg682h0/
Ahmad Saleem
(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."