Add typeahead functionality before the keypress handler