Wicket.Focus.setFocusOnId() doesn't work consistently in IE6/7 after ajax update
--------------------------------------------------------------------------------

                 Key: WICKET-1488
                 URL: https://issues.apache.org/jira/browse/WICKET-1488
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.3
            Reporter: Martijn Dashorst


We have a page where a lot of markup is replaced in an Ajax request. After the 
request we want to set the focus on an element inside the replaced markup. It 
is only an IE problem, where IE6 seems sometimes to work, sometimes not. 
Playing with timeouts and retrying to set the focus appears to work in IE6. IE7 
consistently fails on our page, even with the repeated timeout.

Executing the following code before setting the focus on the element seems to 
fix this issue:

if (Wicket.Browser.isIE()) {
            // There's a strange focus problem in IE that disables focus on 
entire page,
            // unless something focuses an input
            var e = document.createElement("input");
            var x = Wicket.Window.getScrollX();
            var y = Wicket.Window.getScrollY();
            e.style.position = "absolute";
            e.style.left = x + "px";
            e.style.top = y + "px";
            document.body.appendChild(e);
            e.focus();
            document.body.removeChild(e);
        }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to