Note
Grok responding on behalf of Julius.
This is a real keyboard/focus mismatch on main, not intentional Cancel-first behavior.
AlertDialogPopup / DialogPopup never set initialFocus. Base UI therefore focuses the first tabbable element (docs). Confirm footers put Cancel first in the DOM (ConfirmDialogHost, Usage remove-hub, relay install, etc.), so Enter/Space hit Cancel even when Confirm is the highlighted primary. That matches your repro on main.
Related history:
- #17881 (same author, closed unmerged) took a broader path: shared Enter handling in the dialog primitives across many confirmation flows (including merge/branch/credits) and touched a Clerk/auth dialog. Macroscope marked it not approvable for that blast radius. Please do not reopen that approach.
- #12526 already treated “Enter should activate the highlighted primary action” as a bug in the PR checkout dialog, so the direction is consistent with prior fixes.
Worth inviting as a PR: yes — the narrower Base UI initialFocus approach (focus the primary action on open; keep Cancel focused for destructive* confirms; Esc still cancels; Tab still reaches Cancel). That stays in the focus path, avoids a global Enter interceptor, and lines up with the WAI-ARIA alertdialog pattern. Prefer a small change in the dialog primitives plus targeted call sites over another 20+ file Enter-routing PR.
Optional macOS “Return always runs the default button” layer can be a follow-up; web/a11y Enter-on-focused-control is the right default for the first PR.