Opened 12 years ago

Closed 12 years ago

#2780 closed defect (fixed)

ModalDialogBase tries to set focus on invisible element on IE, IE complains loudly

Reported by: guest Owned by: bill
Priority: high Milestone: 0.9beta
Component: Dijit Version: 0.4.2
Keywords: Cc:
Blocked By: Blocking:

Description

The ModalDialogBase?.trapTabs function doesn't take into account that IE won't let you set focus on an element that is hidden or otherwise invisible. When it calls tabEnd.focus() or tabStart.focus() IE6 sometimes puts up its error dialog about not being able to set the focus to an element that is hidden, not visible or disabled.

This can be prevented by wrapping the calls to focus() in a try/catch block. On IE there really isn't a good way to tell if an element fits the criteria where the call would fail, other than simply calling focus() and letting it fail.

ex: try { this.tabEnd.focus() } catch (ex) {}

Change History (3)

comment:1 Changed 12 years ago by alex

(In [8594]) defensive CSS. Makes the menu show up w/o the 1-2 em padding that it had on the test page. Refs #2780

comment:2 Changed 12 years ago by Adam Peller

Component: GeneralDijit
Owner: changed from anonymous to bill

is this still an issue in dijit?

comment:3 Changed 12 years ago by bill

Milestone: 0.9beta
Resolution: fixed
Status: newclosed

No, I think with Becky's change we are never setting focus to an invisible element.

Note: See TracTickets for help on using tickets.