Opened 10 years ago

Closed 10 years ago

#15132 closed defect (duplicate)

dijit/focus should not call _onFocus before onmousedown can be seen

Reported by: Douglas Hays Owned by: bill
Priority: undecided Milestone: 1.7.3
Component: Dijit Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Douglas Hays)

You should be able to see onmousedown followed by onfocus (or _onFocus). But since dijit/focus.js uses the capture=true flag, and then calls _onFocus from the mousedown handler, event handlers waiting on the mousedown see the _onFocus first (and this.focused=true) before seeing the mousedown event. This is causing the failure in robot/ValidationTextBox (placeholder::type in textbox). Chrome and Firefox won't focus the widget's focusNode automatically on mouse down and without seeing the mousedown event before focus, then I don't know ifI should manually change the focus or not. This needs to be fixed in 1.7.3 since it worked OK in 1.7.2. Since then, _FormWidgetMixin is looking for the focus after onmousedown.

Attachments (1)

15132.patch (873 bytes) - added by Douglas Hays 10 years ago.
possible fix

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by Douglas Hays

Attachment: 15132.patch added

possible fix

comment:1 Changed 10 years ago by Douglas Hays

Component: Dijit - FormDijit
Milestone: tbd1.7.3
Owner: changed from Douglas Hays to bill
Status: newassigned

comment:2 Changed 10 years ago by Douglas Hays

Description: modified (diff)

comment:3 Changed 10 years ago by bill

Resolution: duplicate
Status: assignedclosed

Duplicate of #13341.

In other tickets like #13341 and #14838 I've suggested that people use native onfocus events rather than relying on the focus manager.

I'm reluctant to add a setTimeout() to that code since setTimeout() can lead to so many complications. I suppose if we did have a setTimeout(), it would be to trigger the so-called _onFocus() event when there was a mousedown event which wasn't followed by a focus event (such as the case of clicking the non-focusable up/down arrows on a spinner).

Perhaps since this has come up a number of times I should do that. In any case I'll track this in #13341.

Last edited 10 years ago by bill (previous) (diff)
Note: See TracTickets for help on using tickets.