Closed Bug 540579 Opened 15 years ago Closed 2 years ago

Focus jumps two controls when handling tab onkeydown and showing an alert("") (or indeed pausing the thread by other means).

Categories

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

x86_64
Windows Vista
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: b.hinman, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.64 Safari/532.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)

I have a onkeydown event handler setup on a text input.
When the tab key is pressed I show an alert() box.
After clicking OK, focus has been moved 2 controls instead of one.

It seems this also happens with synchronous XHR's and anything else that pauses the current thread.

Reproducible: Always

Steps to Reproduce:
1. I have a onkeydown event handler setup on a text input.
2. When the tab key is pressed I show an alert() box.
3. After clicking OK, focus has been moved 2 controls instead of one.
Actual Results:  
After clicking OK, focus has been moved 2 controls instead of one.

Expected Results:  
Focus moved to the next control (not the next next control!).

A basic example:

<html>
    <head>
    </head>
    <body>
        <input onkeydown="oioi(event)" type="text" />
        <input type="text" />
        <input type="text" />
        <script>
            function oioi(e) {
                if (e.keyCode == 9) {
                    alert("hello");
                }
            }
        </script>
    </body>
</html>
Confirmed with Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.3a1pre) Gecko/20100118 Minefield/3.7a1pre

Firefox 1.0 and also Google Chrome and Opera do it as intended.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I have added my vote to this as we have customers desiring to have this bug addressed.  Our customers are encountering the issue through the use case on the bug 1074140 which has been closed as a duplicate of this one.
Component: Event Handling → User events and focus handling
QA Whiteboard: qa-not-actionable

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

I can't reproduce the issue with the sample HTML, this is fixed I believe.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.