I have a delete confirmation dialog with just text (no input fields). At the bottom of the dialog there is a button that will process the task. From a user experience point of view, should I process the delete if the user presses enter?
The enter key should count as a click, but only if the button is in focus. If nothing is in focus, the enter button should not do anything. Even for modals where there is only one possible action.
When it comes to keyboard controls, it is vital that an element is selected before something can be done with it. This avoids confusion about what the page will do, and it will help people with screen readers who rely on context before they can continue.
You may see cases where buttons are already in focus when they appear, but this is generally limited to software where repeated actions are very common. Then the enter key may act immediately as a continue, because there is something in focus already. You can argue whether this is good UX as you're essentially facilitating bad behaviour to dismiss or continue without reading. On websites it is safer in my opinion to just adhere to web and accessibility standards and not allow for actions without prior input.