Handle leading/trailing whitespace in menu