Closed #5412: Fixed keyboard events loss

Fixed keyboard events loss