Bug Tracker

Modify

Ticket #12161 (closed bug: cantfix)

Opened 11 months ago

Last modified 11 months ago

.focus doesn't work when performed within blur callback

Reported by: cwilkins1@… Owned by:
Priority: low Milestone: None
Component: event Version: git
Keywords: Cc:
Blocking: Blocked by:

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/

Change History

comment:1 Changed 11 months ago by scott.gonzalez

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.

comment:2 Changed 11 months ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to cantfix
  • Status changed from new to closed
  • Component changed from unfiled to event

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/

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.