Opened 8 years ago

Closed 8 years ago

#12658 closed defect (wontfix)

setting focus on filtering select on page load

Reported by: gerhard presser Owned by: Douglas Hays
Priority: low Milestone: 1.8
Component: Dijit - Form Version: 1.6.0
Keywords: filteringselect focus Cc:
Blocked By: Blocking:

Description

hi, calling

dijit.byId("myFilteringSelect").focus();

inside a

dojo.addOnLoad()

doesn't focus the widget in ie8! I tried it with firefox 3/4, ie7 - it works.

deferring the call via window.setTimeout() seems to be a workaround for this problem.

working: http://pastehtml.com/view/1e1upel.html defect: http://pastehtml.com/view/1e22mt0.html

environment: Browser type: internet explorer Browser version: 8 OS and OS Version: windows 7

regards

gerhard

Change History (6)

comment:1 Changed 8 years ago by Douglas Hays

I'm not sure we promise that you can call focus() from addOnLoad. The browser is still processing (like scrolling the window to the previous spot on a page refresh) after addOnLoad is called. IE has always maintained that you should never change focus during another event handler.

comment:2 Changed 8 years ago by bill

Does it work if you do it in a setTimeout?

dojo.ready(function(){
    setTimeout(function(){
       dijit.byId("myFilteringSelect").focus();
    });
}, 0);

comment:3 Changed 8 years ago by gerhard presser

using setTimeout seems to solve the problem - sometimes ;-) it still seems to be a timing(?) issue.

http://pastehtml.com/view/1ecef7m.html

viewing this page on ie8, sometimes focues the filteringselect, sometimes, the select seems focused (outer border is darker), but there's no cursor visible.

comment:4 Changed 8 years ago by Douglas Hays

Milestone: tbd1.8
Priority: normallow

comment:5 Changed 8 years ago by Douglas Hays

Using the setTimeout works well in IE9. IE8 seems confused by the dynamic INPUT. Adding this after your focus call allow it to work in IE8 everytime:
dijit.selectInputText(dijit.byId("myFilteringSelect").textbox, 0, 0);
I can't add this to focus() as a default since it'll reposition the input caret to the start which will be undesirable, except on page load. Since this seems like an IE8 specific bug and there's an easy workaround, and I can't see a way to fix this just for IE8 in the dijit code, this appears to be a wontfix.

comment:6 Changed 8 years ago by Douglas Hays

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.