Before this fix, sometimes dialogs that had the option shouldFocusButtons set on open did not set the focus on the buttons. This is especially true for the "discard changes" dialog where it is less usable with the keyboard. After this fix, we wait for the widget to append itself to the dom before setting the focus.