Focus and blur events bubble from some form input controls

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
15 years ago
11 years ago

People

(Reporter: bugzilla, Assigned: smaug)

Tracking

Trunk
x86
Windows XP
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

15 years ago
When a <select> or input type="reset" receive a focus or blur event, such events
bubble when the specs clearly indicate they should not. MSIE 6 and Opera 7.5 do
not do that.
This bugfile spins off from bug 230356. Bug 190557 refers to the same issue but
for checkbox. Cross-browser testcase coming.
I believe we do this on purpose and I know we have code that relies on these
events bubbling....  in fact, the fact that they don't bubble from text inputs
leads to focus event bugs with <input type="file">
Note that the resolution of this somewhat depends on what we decide to do with
text controls (and that depends on the file input stuff in bug 4033).
Depends on: 4033
(Assignee)

Comment 4

12 years ago
focus doesn't work on type="input" when clicking inputfield. It does work when clicking the button. Though, the inputfield bug has 
nothing to do with this bug and it doesn't work in 1.8 either.
Assignee: events → Olli.Pettay
Status: NEW → ASSIGNED
(Assignee)

Comment 5

12 years ago
Posted patch proposed patch (obsolete) — Splinter Review
Because of bug 334216, non-bubbling events get handled at target also
when dispatched somewhere in anonymous content, so type="file" works.
Attachment #270566 - Flags: superreview?(bzbarsky)
Attachment #270566 - Flags: review?(bzbarsky)
(Assignee)

Updated

12 years ago
Attachment #270563 - Attachment description: testcase with type="input" → testcase with type="file"
(Assignee)

Comment 6

12 years ago
There is no need to call stopPropagation in editor code, if focus and blur events don't bubble. Listener is added there for bubble phase.
Attachment #270566 - Attachment is obsolete: true
Attachment #270573 - Flags: superreview?(bzbarsky)
Attachment #270573 - Flags: review?(bzbarsky)
Attachment #270566 - Flags: superreview?(bzbarsky)
Attachment #270566 - Flags: review?(bzbarsky)
Comment on attachment 270573 [details] [diff] [review]
Fixes also textfield in the file control

This looks OK, I guess, but I wonder whether it'd make sense to move the bubble-prevention into the nsEvent constructor (basically use the message to index into something which would say whether the event bubbles).  I'd really prefer a single data table somewhere to sprinkling this throught the code...

Followup bug on that perhaps?

r+sr=bzbarsky assuming you've tested accesskeys and such and will also check in tests for this.
Attachment #270573 - Flags: superreview?(bzbarsky)
Attachment #270573 - Flags: superreview+
Attachment #270573 - Flags: review?(bzbarsky)
Attachment #270573 - Flags: review+
(Assignee)

Comment 8

12 years ago
(In reply to comment #7)
> but I wonder whether it'd make sense to move the
> bubble-prevention into the nsEvent constructor (basically use the message to
> index into something which would say whether the event bubbles).  

yup, I was thinking that too. I'll post a followup (with a patch for 
focus, blur, error, load, unload, scroll, SVGLoad, SVGUnload).
Everything in nsEvent is inline, I wonder how the change will affect 
codesize. Maybe the constructor should call something non-inline.
You could compile and strip to see how codesize is affected.  ;)

I do think that if it's just an index into a table to set default flags (as opposed to an if cascade or something) it shouldn't be that big.
(Assignee)

Updated

12 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
Whiteboard: Bug 238987 – Focus and blur events bubble from some form input controls
(Assignee)

Updated

12 years ago
Depends on: 386743
Depends on: 386820

Updated

12 years ago
Flags: in-testsuite+
Blocks: 4033
No longer depends on: 4033
(Assignee)

Updated

12 years ago
Whiteboard: Bug 238987 – Focus and blur events bubble from some form input controls
You need to log in before you can comment on or make changes to this bug.