Skip to main content

Bug Tracker

Side navigation

#12161 closed bug (cantfix)

Opened July 30, 2012 08:55PM UTC

Closed July 30, 2012 09:22PM UTC

.focus doesn't work when performed within blur callback

Reported by: cwilkins1@gmail.com Owned by:
Priority: low Milestone: None
Component: event Version: git
Keywords: Cc:
Blocked by: Blocking:
Description

When blurring from a text field I should be able to refocus on the field (for example, when an error is detected) from within the blur callback. This seems to work inconsistently between browsers. In IE8 it works. In Chrome is stays highlighted but really isn't. In Firefox 14 it does not stay highlighted.

Replication:

1. Click inside of the input box.

2. Click outside of the checkbox.

Expected Results:

The input box focused after clicking outside of the textbox.

Actual Results:

The textbox is not focused.

Code to test with:

http://jsfiddle.net/6JBsz/6/

Attachments (0)
Change History (2)

Changed July 30, 2012 08:57PM UTC by scottgonzalez comment:1

You should really set focus asynchronously, especially if you're not preventing the default action of some other event that is causing focus to shift.

Changed July 30, 2012 09:22PM UTC by timmywil comment:2

component: unfiledevent
priority: undecidedlow
resolution: → cantfix
status: newclosed

Scott is right. Use setTimeout to add the focus call to the end of the stack. blur is called at different times by different browsers.

http://jsfiddle.net/6JBsz/7/