Skip to main content

Bug Tracker

Side navigation

#12319 closed bug (patchwelcome)

Opened August 16, 2012 04:05PM UTC

Closed August 21, 2012 02:51AM UTC

Last modified January 09, 2014 01:16PM UTC

IE - input tag in iframe has problem with focus

Reported by: dimhold@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

I dynamically create iframe with <input type="text" /> tag and focus on it.

But on the second creation, all inputs on the page have problem with focus.

Please, download this attachment zip file (issue doesn't reproduce in the jsFiddle):

http://www.wuala.com/dimhold/jquery/ie_input_in_iframe_has_problem_with_focus.zip

Steps to reproduce:

0) Open main.html from zip

1) Click to "Open (jQuery)" button

2) Click to text input in created IFRAME!!! (browser should focus to the text field)

3) Click to "Close (jQuery) link

4) Click to "Open (jQuery)" button AGAIN

5) Click to to text input in created iframe AGAIN

Actual:

IE7: You cannot focus to any inputs on the ALL page! (check bottom input)

IE8: Input has problem with focus on the some time (sometimes forever)... After 3 seconds and 3 click browser focus on it...

IE9: I cannot reproduce this issue on this simple case. But on my very rich application, IE9 has problem with focus too.

Expected:

You can focus to the any inputs.

"Workaround":

You can press "Tab" or focus to input by js (e.g. document.getElementById("field").focus(); ) and the problems goes on...

I guess it is IE bug and jQuery works excellent (of course). But when I create iframe without jQuery (Using "Open (js) button") issue does not reproduce.

Attachments (0)
Change History (2)

Changed August 21, 2012 02:51AM UTC by dmethvin comment:1

resolution: → patchwelcome
status: newclosed

I could not reproduce this problem on IE8 in a VM, but it did fail the way you described in IE7 on Browserstack. The problem does not occur if you change the jQuery creation to this method:

  var $iframe = $("<iframe/>");
  $iframe.attr("src", "iframe.html");
  $("#qres_modal_dialog_contents").html("").append($iframe);

Given that there is a reasonable workaround and this hasn't been reported before, I doubt the team will look into it further. If anyone is interested in investigating please contact us.

Changed January 09, 2014 01:16PM UTC by anonymous comment:2

Hi, I know this is old, but I had a similar problem today, will leave the solution, it might help someone.

The problem happened using IE 10 in the example provided.

The solution proposed by dmethvin didn't work for me.

Not really a solution, but adding the following code to the end of the iframe creation method made all input fields focusable.

$("input[type=text]").first().focus();