You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2014/07/09 14:04:05 UTC

[jira] [Assigned] (WICKET-5564) AjaxRequestTarget.focusComponent() does not work when two Ajax responses arrive next to each other

     [ https://issues.apache.org/jira/browse/WICKET-5564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov reassigned WICKET-5564:
---------------------------------------

    Assignee: Martin Grigorov

> AjaxRequestTarget.focusComponent() does not work when two Ajax responses arrive next to each other
> --------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-5564
>                 URL: https://issues.apache.org/jira/browse/WICKET-5564
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>            Reporter: Andrei Badea
>            Assignee: Martin Grigorov
>
> I have an AjaxButton. Its onSubmit() handler calls AjaxRequestTarget.focusComponent(). After the Ajax response is handled, that component should get the focus, but it does not. Wicket.Focus.setFocusOnId() is called correctly and it does set the lastFocusId field, but Wicket.Focus.requestFocus() finds that Wicket.Focus.refocusLastFocusedComponentAfterResponse is false and does nothing.
> What happens is that, before Wicket.Focus.requestFocus() runs (it scheduled by the first response via setTimeout(0), so it is not synchronous) another Ajax response is  handled. This calls markFocusComponent(), then check checkFocusedComponentReplaced(). The latter method (correctly) determines the focused component was not replaced by the second Ajax response, so it sets Wicket.Focus.refocusLastFocusedComponentAfterResponse to false. When requestFocus() does run, later, it thinks it is just supposed to refocus the component that already has the focus.
> The second Ajax response is triggered by wicket-atmosphere, but  to me this issue is not caused by wicket-atmosphere. The core problem is that two Ajax responses can clobber each other's focus-related state in Wicket.Focus.



--
This message was sent by Atlassian JIRA
(v6.2#6252)