Add typeahead functionality before the keypress handler, CSS fixes