Skip to main content

Search and Top Navigation

#9332 reopened bug ()

Opened May 27, 2013 11:29PM UTC

Last modified September 16, 2013 01:11PM UTC

Dialog: Focus not placed in dialog when it's opened in a change event in IE

Reported by: lsching17 Owned by:
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

I tested this bug is found at least found in IE8-10.

If user edit a textfield A, and then click textfield B immediately, at the same time, the onchange event of A open a dialog for data verification purpose.

The focus will remain in textfield A, which is very bad behaviour for data verification dialog

http://jsbin.com/eqomuq/1

Attachments (0)
Change History (7)

Changed May 28, 2013 02:16AM UTC by tj.vantoll comment:1

resolution: → wontfix
status: newclosed

This is just the nature of IE's focus handling and there's really nothing we can do to help your use case.

Example: http://jsbin.com/eqomuq/11/edit

Type something in the 1st text box then click on the 2nd. There's an event handler that will shift focus to the third text box that will work everywhere but in IE.

You can put a

setTimeout
around the event handler to workaround this: http://jsbin.com/eqomuq/12/edit.

Changed May 28, 2013 11:58AM UTC by lsching17 comment:2

There is no documentation mentions that "autofocus" do not always work cross-browser, this is a trap for developer!

Besides, have you tested that user can still edit text in textfield A behind the modal dialog? Does this beat the purpose of modal dialog?

Will there be a chance for jquery ui to include the workaround for IE: unblur the active element and then focus by settimeout?

As dialog is async in nature, there should be no change in behaviour.

Changed May 28, 2013 12:18PM UTC by tj.vantoll comment:3

If you use the

blur
event this will work as you expect in IE: http://jsfiddle.net/tj_vantoll/e5v9v/.

I'll defer to others as whether this is something that we *can* do as there are a11y repercussions of changing our dialog focus handling. In theory we might be able to wrap our

focus()
call in a
setTimeout
. That being said showing a dialog in a
change
event is definitely an edge case.

Changed May 29, 2013 11:46AM UTC by lsching17 comment:4

if this is the case, please document the shortcoming of IE on dialog's page to remind others, thank you.

Changed May 29, 2013 03:38PM UTC by tj.vantoll comment:5

resolution: wontfix
status: closedreopened
summary: "autofocus" attribute do not work in IE sometimesDialog: Focus not placed in dialog when it's opened in a change event in IE

Changed September 16, 2013 01:05PM UTC by jzaefferer comment:6

So this is only a documentation issue? If so, TJ, could you create a ticket for api.jqueryui.com?

Changed September 16, 2013 01:11PM UTC by scottgonzalez comment:7

I'd like to dig into this before finalizing a decision that this is a can't fix.