-
Notifications
You must be signed in to change notification settings - Fork 673
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
It's not possible to focus on label with tabIndex=0 and "for" attribute #3501
Comments
Thank you for the detailed description. I've reproduced the problem. For TestCafe Team index.html <html>
<head>
<style>
label { background: red; }
label:focus {background: green;outline: 0}
</style>
</head>
<body>
<div>
<label for="radio" tabIndex="0">...</label> <input type=radio id=radio>
</div>
<span id='log'></span>
<script>
var label = document.querySelector('label');
var log = document.querySelector('#log');
label.addEventListener('focus', function () {
log.textContent = log.textContent + 'label focused ';
});
</script>
</body>
</html> test.js import { Selector, t } from 'testcafe';
fixture`Login`.page('http://localhost:8080');
const label = Selector('label');
test('...', async t => {
await t
.setTestSpeed(0.1)
.click(label);
}); |
I have a similar problem which seems related: I've got a custom dropdown component that looks like this: <div tabindex="0">
<div>Placeholder</div>
<div>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</div>
</div> On Chrome/Edge/Firefox/IE11, clicking the outer |
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow. |
What is your Test Scenario?
I have a radio button associated with label using "for" attribute. Label also has "tabIndex" attribute to be focused. When i click on this label using testcafe, it not became focused. But in real situation it is.
What is the Current behavior?
Currently this test always fails.
What is the Expected behavior?
When i'm clicking on this label by mouse, label became focused.
What is your web application and your TestCafe test code?
My component looks like this one
And test case is:
Steps to Reproduce:
Workaround
When i replacing label with span, it works (but i need to check radio button by myself because "for" attribute does not work for spans).
Your Environment details:
The text was updated successfully, but these errors were encountered: