Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Put autofocus on Search input field #3797

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments
Closed

Put autofocus on Search input field #3797

openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments

Comments

@openstreetmap-trac
Copy link

Reporter: guerda
[Submitted to the original trac issue database at 3.14pm, Wednesday, 1st June 2011]

If you visit openstreetmap.org, there's no input field that accepts key strokes immediately. There's no input field at all that may need user inputs, but the search field.
I propose to put the autofocus on the search input field so that a user can directly search for a place, a street or whatever.

The following snippet (inspired by 1) would establish autofocussing the search input field via the HTML5 autofocus attribute and a fallback method for not so current browsers.

    <form action="/" id="search_form" method="get" onsubmit="...">
      <input id="query" name="query" tabindex="1" value="" type="text" autofocus="autofocus">
      <input name="commit" value="Los" type="submit">

    </form>
    <script type="text/javascript">
    if (!("autofocus" in document.createElement("input"))) {
      document.getElementById("query").focus();
    }
    </script
@openstreetmap-trac
Copy link
Author

Author: guerda
[Added to the original trac issue at 5.27pm, Tuesday, 31st January 2012]

Hi rails-dev team!

Is there an option to include this feature?

Kind regards,
guerda

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.57pm, Tuesday, 31st January 2012]

Couple of comments:

  • It would be better to use jQuery rather than non-portable document methods
  • There seems to be little benefit to using the HTML5 autofocus attribute - if we need the fallback code for other cases then we might as well just use it all the time

At the end of the day, it will happen a lot quicker if you provide a patch for the source, otherwise you'll have to wait until somebody is interested enough to write one.

@openstreetmap-trac
Copy link
Author

Author: ppawel[at]fastmail.fm
[Added to the original trac issue at 2.59pm, Wednesday, 12th December 2012]

openstreetmap/openstreetmap-website#175

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 7.34pm, Thursday, 13th December 2012]

Fixed by http://git.openstreetmap.org/rails.git/commit/bdc536d126d884b0795bf82784fc81d4a5e47dcc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant