Use keyup instead of keypress (last character is not persisted)