Restore autofocus to the searchbar in TPAC user/dbs/restore_searchbox_focus
authorDan Scott <dscott@laurentian.ca>
Mon, 5 Mar 2012 04:15:58 +0000 (23:15 -0500)
committerDan Scott <dscott@laurentian.ca>
Mon, 5 Mar 2012 04:54:52 +0000 (23:54 -0500)
commit417ce7c0e062fbe4c6b67bcf9b610088874ffeac
tree067e9880bbe84e6760513bd5a0beb8b0f70d86ad
parentd3bf88739ea88768d92831062219f76f58b6a1e3
Restore autofocus to the searchbar in TPAC

The switch to autosuggest gave us great functionality, but we lost
autofocus for effortless initial searching. Restore it, with and without
Dojo. For the latter case, just use HTML5's autofocus attribute to begin
with; later on we can use something like Modernizr to detect browsers
that don't support this attribute and prop them up with additional
JavaScript, but let's not let that prevent us from getting a good bang
for our attribute buck in the short term.

Note the slightly painful workaround required to get the cursor to
position itself at the end of the input value of the Dojo autosuggest
widget on page load. This is what we get for stepping back into the
world of JavaScript :)

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2