What I did was I created an extra input and made it invisible (style="display:none"
) then gave it the property autofocus="true"
put this at the end of your dialog content so it wont mess with anything. it should look like this:
<div><!--dialog div-->
<button></button>
<button></button>
<input type="hidden" autofocus="true" />
</div>