-
Notifications
You must be signed in to change notification settings - Fork 184
Tabbing through iframe in Firefox doesn't work #2693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ok I found a work around, if I delay iframe content creation in the script, then the tabbing works normal and test passes. For delay, timeout amount varies based on the project, in this example, timeout of 0ms works, but for my project I had to bump it up for 50 ms. updated script inside html file setTimeout(() => {
run()
})
function run() {
const doc = iframe.contentWindow.document;
doc.write('<html><body style="background: #f5f5df;"><div> <h1 style="font-size: 14px">Same Domain Iframe</h1> <button>Button</button> <br><br> <a href="#">Link</a> <br><br> <input type="text" placeholder="Text input..."></body> </html>');
doc.close()
} updated html <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id="first-button">first button</button>
<br>
<iframe frameborder="0"></iframe>
<br>
<button id="last-button">last button</button>
<script type="module">
const iframe = document.querySelector('iframe');
setTimeout(() => {
run()
})
function run() {
const doc = iframe.contentWindow.document;
doc.write('<html><body style="background: #f5f5df;"><div> <h1 style="font-size: 14px">Same Domain Iframe</h1> <button>Button</button> <br><br> <a href="#">Link</a> <br><br> <input type="text" placeholder="Text input..."></body> </html>');
doc.close()
}
</script>
</body>
</html> |
Thank you for reporting this. I have reproduced the behavior you described. We will update this thread once we have any news. |
What is your Scenario?
There's two buttons and in between them is a same domain iframe, which contains 3 tabbable elements. The point of the test is to tab through all items including the ones inside the iframe. I've tested in Chrome and it works, but Firefox fails.
This is a testcafe issue because I opened Firefox browser and tabbed through iframe normally.
What is the Current behavior?
After clicking first button, then start tabbing 4 times, it only tabs to iframe's 1st tabbable element and hangs there, test doesn't throw error but hangs.
What is the Expected behavior?
After tabbing 4 times the active element should be the last button, which is not an iframe element.
App Code
Your Environment details:
The text was updated successfully, but these errors were encountered: