Skip to content
This repository has been archived by the owner. It is now read-only.

Search field on http://www.openstreetmap.org should autofocus #5065

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

Search field on http://www.openstreetmap.org should autofocus #5065

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

Comments

@openstreetmap-trac
Copy link

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Reporter: Vinnl
[Submitted to the original trac issue database at 7.26pm, Monday, 9th December 2013]

Currently, when I open http://www.openstreetmap.org there is no way to interact with it directly using the keyboard. Since the most frequent action will likely be to search for a destination, the search field should receive the HTML autofocus attribute[1]. Apparently this was added to the previous website as well: #3797

[1] http://diveintohtml5.org/forms.html#autofocus

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 9.26am, Tuesday, 10th December 2013]

I have to say I remain entirely unconvinced by the claim that the first thing most people will do is to search. That might possibly be true for new users but I very much doubt it is for returning users.

What I can say is that overall we have five times more visitors to the front page than we do searches, and that includes all searches not just those made immediately after arriving on the front page.

The real problem however, given that regardless of how important you think this is there is little real downside, is that the new site design includes placeholder text in the search field which will, to some extent, conflict with autofocusing.

What I'm not sure about yet is how much. Certainly in Firefox at least it appears to be safe to use HTML5 autofocus as no focus event will be generated (that would fade out the placeholder) until the user starts to type. Whether that is true in other browsers needs to be determined.

In older browsers we used to focus via javascript instead, but that would almost certainly generate a focus event. Then again I guess the placeholder text (which is generated by an HTML5 placeholder attribute) may not show there anyway.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 9.38am, Tuesday, 10th December 2013]

An update following some browser testing:

Firefox 25 - HTML5 autofocus preserves placeholder[[BR]]
Chrome 31 - HTML5 autofocus preserves placeholder[[BR]]
Opera 12 - HTML5 autofocus loses placeholder[[BR]]
IE 8 - No placeholder shown, needs JS autofocus

Opera 12 isn't a major issue as I'm guessing the new webkit based version will do what Chrome does, and likely Safari will as well. Would be good to know what later IEs do.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 9.44am, Tuesday, 10th December 2013]

Update:

IE10 - No placeholder shown, needs JS autofocus[[BR]]
Safari - HTML5 autofocus preserves placeholder

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 6.36pm, Tuesday, 10th December 2013]

It seems IE11 does show the placeholder but (a) removes it on focus rather than when you start typing and (b) doesn't support the autofocus attribute.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 7.50pm, Tuesday, 10th December 2013]

Fixed in [changeset:9cc9a00/rails].

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: Vinnl
[Added to the original trac issue at 10.29am, Thursday, 19th December 2013]

Thanks TomH, looks great. I must admit that I'm a new user, but as such, I'm loving this.

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

Successfully merging a pull request may close this issue.

None yet
1 participant