You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Christopher Dodunski (Tapestry)" <Ch...@christopher.net.nz> on 2021/10/27 08:36:46 UTC

Browser automatically scrolls to contact form in footer (undesirable)

Hi all,

I've built a new home page for an existing site, and this includes a 
simple contact form in the footer.  When the page loads the browser 
automatically scrolls down to this form, with cursor in the first field. 
  This obviously isn't desirable.

Plain HTML forms don't normally invoke this behaviour, which has me 
thinking that some JavaScript may be involved.  Either on the part of 
Tapestry, or Bootstrap which it employs.

If blocking forms from grabbing focus is possible with a simple CSS 
directive then I've not found it.  What would be the simplest or 
cleanest solution to this potentially common problem?

Thanking you in advance for any suggestions.

Chris.

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


Re: Browser automatically scrolls to contact form in footer (undesirable)

Posted by Cezary Biernacki <ce...@gmail.com>.
Hi,
Tapestry automatically puts focus on the first field of a form. You can
switch off this behaviour by setting the "autofocus" property on the form
to false.

See
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html

Cezary


On Wed, Oct 27, 2021 at 9:37 AM Christopher Dodunski (Tapestry) <
ChrisFromTapestry@christopher.net.nz> wrote:

> Hi all,
>
> I've built a new home page for an existing site, and this includes a
> simple contact form in the footer.  When the page loads the browser
> automatically scrolls down to this form, with cursor in the first field.
>   This obviously isn't desirable.
>
> Plain HTML forms don't normally invoke this behaviour, which has me
> thinking that some JavaScript may be involved.  Either on the part of
> Tapestry, or Bootstrap which it employs.
>
> If blocking forms from grabbing focus is possible with a simple CSS
> directive then I've not found it.  What would be the simplest or
> cleanest solution to this potentially common problem?
>
> Thanking you in advance for any suggestions.
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>