Improve player modals: Escape to close, trash icon for delete
Both player management and create/edit modals now close on Escape. Delete player character button uses Trash2 icon instead of X to distinguish permanent deletion from dismissal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,15 @@ export function CreatePlayerModal({
|
||||
}
|
||||
}, [open, playerCharacter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
function handleKeyDown(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") onClose();
|
||||
}
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
return () => document.removeEventListener("keydown", handleKeyDown);
|
||||
}, [open, onClose]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user