If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Text input field change detected with asymmetrical checkpoints (before focus and before blur)




DOM: Events
11 years ago
4 years ago


(Reporter: Jeff, Unassigned)



Firefox Tracking Flags

(Not tracked)





11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8b2) Gecko/20050702
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8b2) Gecko/20050702

The browser internally compares the value of a text input before the onfocus handler executes to the value before the onblur handler executes. This causes modifications to the value in the onfocus handler to be detected as actual user changes (even if that change is reverted in the onblur handler) and causes the onchange handler to be executed. Other browsers (I've tested IE6, Opera 8 and Safari ?) internally take note of the value after the onfocus handler and before the onblur handler. I have supplied a simple web page to illustrate the problem.

Reproducible: Always

Steps to Reproduce:
1. Go to http://www.uselesspickles.com/files/browser_problems/hint.html
2. Tab through the input fields with hints displaying.
3. Tab into an input with a hint displaying then press the Esc key.

Actual Results:  
Step 2: The onchange handler for the input fields gets called just by tabbing through a field that is displaying a hint.

Step 3: The value that was in the input before onfocus (the hint text) will be placed in the input.

Expected Results:  
Step 2: The onchange handler should only be called when the user actually makes a change to the value in the input field.

Step 3: Pressing Esc should revert the value of the field to what was in the field immediately after receiving focus; not what was in the field before executing the onfocus event.

Also a problem in Firefox.

Comment 1

11 years ago
==> DOM
Assignee: general → events
Component: General → DOM: Events
Product: Mozilla Application Suite → Core
QA Contact: general → ian
Version: unspecified → Trunk
Assignee: events → nobody
QA Contact: ian → events
You need to log in before you can comment on or make changes to this bug.