What gets focused by default can vary based on platform and host app.
If you want to be sure a specific control gets focused when your dialog shows up, you can leverage the load
event for the dialog
:
document.querySelector("#yourDialog").addEventListener("load", () => {
// wait a frame for things to settle
setTimeout(() => document.querySelector("#imageSize").focus(), 16);
});