Closed Bug 534833 Opened 15 years ago Closed 14 years ago

click event is occasionally lost in text form controls when focus event changes the value of the control.

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: minglq.9, Assigned: smaug)

Details

Attachments

(5 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5

I bind two events focus and click to a text input, focus to change the value of the input, and click to do something else. 
At the beginning, the input has not been focused, and the value of it is "test |", then click on the input. If cilck after after the "|", the click event will be triggered, but if click before the "|", the click event will NOT be triggered. 
I used the JQuery-1.3.2.js library, I consider it is a bug of the Firefox, because it does not occur in any other browsers except Firefox. 

Reproducible: Always

Steps to Reproduce:
I will attach my demo, open with Firefox(I have tested with Firefox-3.5.5 and 2.0.0.20). 
1.Click anywhere first to make sure the input has not been focused; 
2.Click on the input AFTER the "|", then you will get "click" and "focus"; 
3.Repeat step 1; 
4.Click on the input BEFORE the "|", then you will get "focus" only; 
5.Repeat steps 1 - 4 with any other browser, e.g. Oprea-10.10, Chrome-3.0.195.33, IE-8, the bug will not be occurred; 
Actual Results:  
The behavior in Firefox is very strange, and different form the other browsers. 

Expected Results:  
Get "click" and "focus" always. 

JQuery-1.3.2.js
Attached file a simple demo
JQuery
http://jquery.com/
Component: General → Event Handling
Product: Firefox → Core
QA Contact: general → events
Version: unspecified → 1.9.1 Branch
Any one here?
Interesting. I haven't seen this bug filed before, but I assume the problem
has been there forever.
The problem is probably that when clicking the text, textframe gets mousedown
then focus removes or modified the textframe and mouseup goes to the anonymous
div inside <input>. Or perhaps mousedown goes to anon div, but mouseup to
<input> element.
I'll debug this.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Version: 1.9.1 Branch → Trunk
Summary: Bind two events focus and click to a text input, focus to change the value of the input, but the click event will not be triggered sometime. → click event is occasionally lost in text form controls when focus event changes the value of the control.
(In reply to comment #5)

I have tested again, and I found all the events were triggered except "click". 
Click after the "|": mousedown > focus > mouseup > click; 
Click before the "|": mousedown > focus > mouseup.
Once I commit, I can not update anything anymore :(
I have the patch for this. I just need to mochitestify my testcases.
Assignee: nobody → Olli.Pettay
Attached patch patchSplinter Review
For native anonymous content, generate click, even if the target has changed
from #text to anonymous div.
We don't want that behavior always, since generally that is not what 
browsers seem to do.

Posted the patch to tryserver.
Attachment #423010 - Flags: review?(roc)
http://hg.mozilla.org/mozilla-central/rev/5412edab7497
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: