The action of the Escape key on a modal dialog is clear in that it closes the dialog, effectively clicking a 'Cancel' button or similar.
However, what is the current consensus of the Enter key while in a modal dialog and not focused on a button?
In the sample modal above, from HTML forms one might expect a dialog's contents (if any) to be submitted as though the user has clicked the 'Save' button.
However, the modal might also be a confirmation to delete, modify, approve, unattach something, etc. It may also contain non-form data manipulation, more akin to a modal window than dialog. Consistency would then suggest that Enter continues to perform the primary action in other dialogs, even without form content. But this then goes against my instinct of defaulting to a safe action, and the well-established principle of making it clear what action modal buttons will perform.
It would be all too easy for a user to accidentally hit Enter (the bottom-right of many keyboards) and perform an action that might cause a change that is difficult or frustrating to undo.
With the above issues, it seems like it may be easier to not allow any action on the Enter key at all unless a button is focused. To balance this with speedy keyboard navigation, perhaps focusing on the 'Cancel' button first might be best, allowing a tab to the primary (unsafe) action button. Tab-Enter seems a reasonable compromise for safety.