Consider a page with the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
.steal-focus { overflow-y: scroll }
</style>
</head>
<body>
<form action="/">
<input type="text" value="First">
<div class="steal-focus">Content</div>
<input type="text" value="Second">
</form>
</body>
</html>
<div>
instead of the second text field, because of the overflow-y: scroll
.This behavior is unique to Firefox: this doesn't happen on IE, Safari, or Chrome. How can I get around this behavior, which sounds like a Firefox bug to me? I'd like the tab to skip over the <div>
even if it has an overflow-y: scroll
.
Use the tabIndex
attribute to control the order of items that Tab jumps through. Like this:
<body>
<form action="/">
<input type="text" value="First" tabIndex="1">
<div class="steal-focus">Content</div>
<input type="text" value="Second" tabIndex="2">
</form>
</body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With