Unfortunately it doesn’t work in InDesign
I opted to use the (UXP) Dialog, even if they are not fully compatible.
I recommend using the helper library “Adobe XD Plugin Helpers”.
In my case I was using InDesign 19.4 which has a bug that always places the Dialog in the lower left corner ignoring also the dimension provided.
I randomly found a solution: force the dialog dimension via css for some reason make InDesign display the Dialog in the center of the screen.
dialog {
width: 600px !important;
form {
width: 100% !important;
}
max-height: 100px;
}