Automatic height adjustment of dialog