Opened 6 years ago

Last modified 5 years ago

#9332 reopened bug

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

Change History (7)

comment:1 Changed 6 years ago by tj.vantoll

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.

comment:2 Changed 6 years ago by lsching17

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.

comment:3 Changed 6 years ago by tj.vantoll

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.

comment:4 Changed 6 years ago by lsching17

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

comment:5 Changed 6 years ago by tj.vantoll

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

comment:6 Changed 5 years ago by Jörn Zaefferer

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

comment:7 Changed 5 years ago by Scott González

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

Note: See TracTickets for help on using tickets.