handling of tab and enter keys