Prevent empty dialog having focus on close button

Prevent empty dialog having focus on close button

Hello,
when I open a dialog with no interactive elements inside (buttons, inputs), by default the close button receives focus. This causes the dialog to close if the user hits enter key, which I also use for other purposes. Is there a way to prevent the close button from receiving focus?

Thanks!