// removing the captionWrap
focusedElement.focus();
} else if (currentFocus != focusedElement) {
// Focus is either moved somewhere else on purpose or IE has
// lost it. Investigate further.
Timer focusTimer = new Timer() {
@Override
public void run() {
if (Util.getFocusedElement() == null) {
// This should never become an infinite loop and
// even if it does it will be stopped once something
// is done with the browser.
schedule(25);
} else if (Util.getFocusedElement().equals(
Document.get().getBody())) {
// Focus found it's way to BodyElement. Now it can
// be restored
focusedElement.focus();
}
}
};
if (BrowserInfo.get().isIE8()) {
// IE8 can't fix the focus immediately. It will fail.
focusTimer.schedule(25);
} else {
// Newer IE versions can handle things immediately.
focusTimer.run();
}
}
}
}