I have a text field
= text_field_tag('search_text_1', params[:search_text],
options = {:type => 'search'} )
which generates
<input id="search_text" name="search_text_1" type="search">
that I want to add HTML5 autofocus to, as in
= text_field_tag('search_text_1', params[:search_text],
options = {:type => 'search', :autofocus => true} )
This generates
<input autofocus="autofocus" id="search_text" name="search_text_1" type="search">
which does actually work, but how I can I get the actual HTML output for the autofocus
to be as the HTML spec shows, i.e.
<input autofocus id="search_text" name="search_text_1" type="search" autofocus>
# Not sure where it goes or if that matters
Using
options = {:type => 'search', :autofocus }
gives
.../_search.html.haml:2: syntax error, unexpected '}', expecting =>
...:type => 'search', :autofocus } )
As the HTML5 spec at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input says, "which is a Boolean"