Welcome to WebmasterWorld Guest from 54.205.88.118

Forum Moderators: incrediBILL

Stop Firefox from tabbing focus to body element?

Firefox keeps giving the body element focus during tabindex.

   
7:19 am on Jun 5, 2007 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



My site's layout uses an iframe like div and therefor the body element does not scroll, show scrollbars, or have any content on it in essence. However Firefox keeps insisting that the body element should be given focus every tabindex cycle. Not official lingo though I am using the word cycle for when the user cycles past all the focusable elements and returns to the browser GUI, which they will eventually tab back to the rendering area with the site/page. With my layout (and no I'm not changing my layout) Firefox creates a bug where only the body is given focus regardless of the fact that all three anchors in the following test case have tabindex attributes (and of course the body does not) on the second cycle.

The only way to negate an element from the tabindex according to the W3C is to disable it. I wanted to add the disable attribute dynamically with JavaScript (and not have to do so at the server because of validation issues). Correct - this is not valid code however it's also not valid behavior. I was not able to find the specific XHTML article though most HTML 4 is the same (with some deprecations to the contrast) as XHTML...
[w3.org...]

I have even manually attempted to add the disabled attribute to the body directly and Firefox still tabs to it! Suggestions?

- John

*Edit* Ops, helps to post the code! ;)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Tabindex Test</title>
<style type="text/css">

body:disabled {}
</style>
<script type="text/javascript">
document.getElementsByTagName("body").setAttribute("disabled", disabled);
</script>
</head>

<body disabled="disabled">

<div>
<a href="#" tabindex="1">anchor 1</a>
<a href="#" tabindex="2">anchor 2</a>
<a href="#" tabindex="3">anchor 3</a>

</div>

</body>
</html>

[edited by: JAB_Creations at 7:20 am (utc) on June 5, 2007]

8:03 pm on Jun 5, 2007 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I have narrowed down the issue to

bug 383349 [bugzilla.mozilla.org].

- John

[edited by: jatar_k at 9:54 pm (utc) on June 5, 2007]
[edit reason] fixed link [/edit]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month