Dialog: Honor preventDefault when managing focus

If event.isDefaultPrevented() is true, the focus management is
completely skipped, assuming the user manages focus manually.

Fixes #10103
Closes gh-1265