You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2017/12/06 21:08:36 UTC

Scroll to feedback on ajax

We're using Wicket 6.  We have a requirement to set focus to the feedback
panel anytime it shows.  We add our feedback panel in a common module and I
put window.scrollTop(0,0) in  the renderHead of a behavior on the feedback. 
This works on some pages but not all. 

On the pages where it doesn't work I can see the window.scrollTop in the
response body in the browser devtools.  I put an alert and so I can see it
runs.  But it only moves the focus up slightly.  When I don't add the whole
form to the response (it sets field styles, aria tags and there are
component feedbacks as well as the main feedback), I can move to the top,
but as I add individual parts back in, they don't work entirely right.

Has anyone seen anything like this?  Can anyone suggest something that
doesn't involve me slowly undoing everything in these pages to find the
culprit?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Scroll to feedback on ajax

Posted by Sven Meier <sv...@meiers.net>.
Hi,

target.focusComponent(null) should remove all focus.

Have fun
Sven


Am 07.12.2017 um 16:53 schrieb Entropy:
> That sounds plausible.  Is there any way to override that behavior?  We tried
> focusComponent() and it didn't seem to work any better.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Scroll to feedback on ajax

Posted by Entropy <bl...@gmail.com>.
That sounds plausible.  Is there any way to override that behavior?  We tried
focusComponent() and it didn't seem to work any better.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Scroll to feedback on ajax

Posted by Sven Meier <sv...@meiers.net>.
Hi,

after form submit Wicket restores the focus on the input element with 
previous focus. The browser will scroll to that element.

Maybe this counteracts your scrollTop()?

Have fun
Sven


Am 06.12.2017 um 22:08 schrieb Entropy:
> We're using Wicket 6.  We have a requirement to set focus to the feedback
> panel anytime it shows.  We add our feedback panel in a common module and I
> put window.scrollTop(0,0) in  the renderHead of a behavior on the feedback.
> This works on some pages but not all.
>
> On the pages where it doesn't work I can see the window.scrollTop in the
> response body in the browser devtools.  I put an alert and so I can see it
> runs.  But it only moves the focus up slightly.  When I don't add the whole
> form to the response (it sets field styles, aria tags and there are
> component feedbacks as well as the main feedback), I can move to the top,
> but as I add individual parts back in, they don't work entirely right.
>
> Has anyone seen anything like this?  Can anyone suggest something that
> doesn't involve me slowly undoing everything in these pages to find the
> culprit?
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org