Is there a way to make the Dialog API produce a modal dialog - where it must be dismissed before the background can be interacted with?
The example I have seen
isn't modal - in it allows the user to click on the background and interact with the passage contents without explicitly dismissing the "modal" dialog.
That example uses an <iframe> element to display the example Twine story, which is why you can click on elements outside the <iframe> even when the modal dialog is displayed. When the Twine story is the whole window, then the modal dialog will actually be modal. See this Alert and Dialog sample code here (you can click "Jump to Start" in the UI bar to see other sample code there as well).