Open Bug 240722 (this.blur()) Opened 20 years ago Updated 2 years ago

Impossible to navigate form elements by tabbing when at least one element contains onfocus="this.blur()"

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

People

(Reporter: ben, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040415 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040415 Firefox/0.8

When navigating form elements using tab/shift-tab keys it is impossible to
navigate past a form element that contains onfocus="this.blur()".

When an element that contains onfocus="this.blur()" is focused the focus is
returned to the previously focused element instead of advancing to the next
available element.  This makes it impossible to navigate form elements using the
keyboard if one or more of the form elements contains onfocus="this.blur()".

Reproducible: Always
Steps to Reproduce:
1. Use the following HTML:

<html>
    <head>
    </head>
    <body>
        <form name="sample">
            <select name="test">
                <option value="1">One</option>
                <option value="2">Two</option>

                <option value="3">Three</option>
            </select>
            <textarea name="test2" onFocus="this.blur()"></textarea>
            <input type="text" name="test3">
        </form>
    </body>
</html>

2. Attempt to navigate the form using the tab and/or shift-tab keys.
3. It is impossible to navigate past the textarea in either direction.

Actual Results:  
If tabbing the focus returns to the previously focused form element and it is
impossible to advance past the element that contains the onfocus="this.blur()".

Expected Results:  
When tabbing/shift-tabbing and a form element that contains
onfocus="this.blur()" is encountered the focus should advance past this element
to the next available element so that the form can be navigatted by keyboard.

It should be noted that in both Moz 1.6 and FireFox 0.8 (at least under XP)
tabbing to a form element that contains onfocus="this.blur()" causes a crash. 
This has been fixed in recent nightly builds.
Attached file testcase
I just created a file with the example shown by the reporter. Confirming bug
using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a) Gecko/20040416
Alias: this.blur()
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
<html>
<head>
  <title>test</title>
</head>
<body>
<form name="sample">
  <input type="text" name="test">
  <input type="text" name="test2" onfocus="this.blur()">
  <input type="text" name="test3">
</form>
</body>
</html>

gives with Firefox 0.9
Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.8

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: <unknown filename> ::
onfocus :: line 0"  data: no]
Confirming this bug on
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b4) Gecko/20050911
Debian/1.4.99+1.5beta1-2 Firefox/1.4
Occurs on a polish auction site Allegro.pl which is one of the most visited
sites in Poland, making it impossible to navigate though it with Tab.
Still present in:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/2007031002 Iceweasel/2.0.0.3 (Debian-2.0.0.3-2)
Very annoying bug for accesibility. Why does it take over 3 years to fix this? 
I made a Greasemonkey script to work around this bug: http://userscripts.org/scripts/show/9628
Assignee: events → nobody
QA Contact: ian → events
Component: Event Handling → User events and focus handling
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: