Re:How MDN's Autocomplete Search Works
by chrismorgan on Tuesday August 03, 2021 @09:20PM
(#28056224)
> They should have just had the search field focused automatically
No, this would be extremely wrong: it’d open on-screen keyboards automatically on platforms that use them, mess with screen readers by dropping them in the search box rather than at the head of the page, and break keyboard functionality, most significantly things like arrow keys and Space for in-page navigation.
The autofocus attribute sometimes seems like a good idea, but it’s actually almost never desirable.
No, this would be extremely wrong: it’d open on-screen keyboards automatically on platforms that use them, mess with screen readers by dropping them in the search box rather than at the head of the page, and break keyboard functionality, most significantly things like arrow keys and Space for in-page navigation.
The autofocus attribute sometimes seems like a good idea, but it’s actually almost never desirable.