Opened 11 years ago

Closed 10 years ago

#8482 closed defect (wontfix)

Using dijit.focus() in conjuntion with wipeIn() race condition

Reported by: coldfire22x Owned by: dante
Priority: high Milestone: 1.4
Component: fx Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

When calling dijit.focus() on a dijit.form.TextBox? from within the onEnd handler of dojo.fx.wipeIn(), the TextBox? is focused and can immediately accept input but the blinking cursor does not appear. The result is that it's not immediately clear to the user that he/she can begin entering input into the TextBox? (subjective, of course).

It appears to be a race condition that specifically affect Firefox 3. The problem does not exist in IE6. Have not tested in other environments.

Attachments (3)

without_animation.txt (1.3 KB) - added by coldfire22x 11 years ago.
Working example without animation
with_animation.txt (1.5 KB) - added by coldfire22x 11 years ago.
Demonstration of non-working example with animation
with_animation_and_timeout.txt (1.5 KB) - added by coldfire22x 11 years ago.
Demonstration of how setTimeout beats the race condition

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by coldfire22x

Attachment: without_animation.txt added

Working example without animation

Changed 11 years ago by coldfire22x

Attachment: with_animation.txt added

Demonstration of non-working example with animation

Changed 11 years ago by coldfire22x

Demonstration of how setTimeout beats the race condition

comment:1 Changed 11 years ago by dante

Milestone: tbd1.4
Owner: changed from Bryan Forbes to dante
Status: newassigned

comment:2 Changed 10 years ago by dante

Resolution: wontfix
Status: assignedclosed

so I'm not sure there is much (if anything) we can do about this. It seems a stack issue with defining the onEnd as part (inside) of the Animation declaration. adjusting the "with_fx" example about to do:

            var a = dojo.fx.wipeIn({
                node:parent,
                duration:400
            });

			dojo.connect(a, "onEnd", tb, "focus");

			a.play();

(connecting externally rather than within the same 'thread' as the wipeIn call) seems to free the stack up and allow the focus to happen fine. This is ultimately the same as doing the setTimeout(..., 0).

Focus has always been a little odd like this, and while I'd love for this to work the same in all browsers, I can't see calling the animation event callbacks in a timeout being beneficial outside of this edge case. (I didn't test that, just assuming that is what it would take to ensure the stack is 'cleared')

I wish I had a more positive resolution here. Perhaps I'm missing something.

Note: See TracTickets for help on using tickets.