Bug 240722 (this.blur())

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




Event Handling
14 years ago
8 years ago


(Reporter: Ben Holt, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



14 years ago
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:

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

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

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.

Comment 1

14 years ago
Created attachment 146299 [details]

Comment 2

14 years ago
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


14 years ago
Alias: this.blur()
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All

Comment 3

14 years ago
<form name="sample">
  <input type="text" name="test">
  <input type="text" name="test2" onfocus="this.blur()">
  <input type="text" name="test3">

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]

Comment 4

12 years ago
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.

Comment 5

11 years ago
Still present in:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2007031002 Iceweasel/ (Debian-
Very annoying bug for accesibility. Why does it take over 3 years to fix this? 

Comment 6

11 years ago
I made a Greasemonkey script to work around this bug: http://userscripts.org/scripts/show/9628
Assignee: events → nobody
QA Contact: ian → events
You need to log in before you can comment on or make changes to this bug.