Opened 8 years ago

Closed 7 years ago

#18095 closed defect (invalid)

NumberTextBox: change event on <input> DOM node is flaky

Reported by: chmielot Owned by: bill
Priority: blocker Milestone: 1.11
Component: Dijit - Form Version: 1.9.3
Keywords: Cc:
Blocked By: Blocking:


Bug affects all version from 1.8.0 (since then, widget events are published to DOM). Bug appears in Chrome 35.0.1916.153 on a Mac and on Windows. Bug does not appear in Firefox. Locale is de_DE.

When using NumberTextBox? the change event is not always triggered, when bound to the DOM node. In the attachment find a simple test case.

Steps to reproduce: 1) Type 53 into the field 2) Press tab key, alert appears, onchange worked. 3) Type 54 into the field 4) Blur by clicking somewhere else => alert appears, onchange worked. 5) Type 1022 into the field 6) Press tab key, onchange works 7) Type 1023 into the field 8) Blur by clicking somewhere else => alert does not appear(!)

It seems to be connected to the thousands-separator (dot "." in my locale) and thus to some formatting function. This problems also affects CurrencyTextBox? which automatically appends a currency and doesn't trigger onchange event when bluring the field by clicking somewhere else.

Attachments (1)

test.html (1017 bytes) - added by chmielot 8 years ago.
Simple test case

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by chmielot

Attachment: test.html added

Simple test case

comment:1 Changed 8 years ago by dylan

Milestone: tbd1.11
Owner: set to bill
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 8 years ago by chmielot

Any updates on this?

comment:3 Changed 7 years ago by chmielot

For people that are having the same problem: a workaround is to bind the blur event directly on the dijit object, not on its DOM node.

comment:4 Changed 7 years ago by dylan

Priority: highblocker

comment:5 Changed 7 years ago by bill

Resolution: invalid
Status: assignedclosed
Summary: change event is not triggered on "formatted" NumberTextBoxNumberTextBox: change event on <input> DOM node is flaky

Sorry, but (as you seem to have figured out), you need to listen to the change event on the widget itself, not on the widget's focusNode, i.e:

widgetId.on("change", callback);

Or alternately, do it declaratively,

Your test is doing:

on(dom.byId('testid'), on.selector('input', 'change'), function() {

I can see why you want to do it that way, to use event delegation, but unfortunately that's not supported.

Note: See TracTickets for help on using tickets.