Do not always set the focus to the original element after closing the dialog
The documentation of the dialog widget states: "Upon closing a dialog, focus is automatically returned to the element that had focus when the dialog was opened".
This makes sense for modal dialogs, but for non-modal dialogs this results in unwanted behavior for users.
The "Upon closing a dialog, focus is automatically returned to the element that had focus when the dialog was opened" behavior should only be applied after closing from a modal dialog and not modeless ones.
Regards, Hugo.