Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#12319 closed bug (patchwelcome)

IE - input tag in iframe has problem with focus

Reported by: dimhold@… 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.

Change History (2)

comment:1 Changed 5 years ago by dmethvin

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.

comment:2 Changed 4 years ago by anonymous

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();
Note: See TracTickets for help on using tickets.