I'm using jQuery UI 1.8.4, I have a context menu that opens up a dialog window. When the dialog window opens it doesn't get focused on. I try setting the autofocus in my checkbox element, also tried using $('input[type="checkbox"]').eq(0).focus()
and $('input[type="checkbox"]').first().focus()
. I also tried using open (event, ui) and focus (event, ui). None of the elements in the dialog gets focused on.
If I tab using the keyboard it doesn't get into the dialog window until its done with the tabbable objects behind it. The only way I got for the focus to work is if I used the mouse and clicked on the dialog. What would be causing my focus to not work? Here is my code.
assignmentContextMenu(){
var assignment_menu_items = [];
var assignment_menu = {};
assignment_menu_items.push({
name: 'Patient Info', title: 'Patient Info',
fn: function(el) {
$("#modal_window iframe").attr('src', "../Info?op=view&nosidemenu=1&patient_id="+patient_id+"&closeOnQuit=1").load(function() {resizeIframe(this)});
$("#modal_window").dialog({
modal: true,
show: 'scale',
hide: 'scale',
width: 'auto',
height: 'auto',
position: [670, 115],
open: function(event,ui) {
$('input[type="checkbox"]').eq(0).focus();
},
close: function() {
window.location.reload();
}
});
}
});
assignment_menu_items.push({
name: 'Close Menu', title: '',
fn: function(el){return false}, });
assignment_menu = new ContextMenu('patient_assignment_context_menu_'+count_id, 'Assignment Context Menu Options', '#info-'+patient_id, assignment_menu_items, {type:0});
count_id +=1;
}