fix: remove duplicate ESC handlers causing double history.back()
AboutModal, ProfileModal, and ShareDialog each had their own useEscapeKey hook AND were handled by the global ESC handler in App.tsx. When ESC was pressed, both fired synchronously, calling history.back() twice — navigating past the current page instead of just closing the modal. Removed the per-modal useEscapeKey calls since the global handler in App.tsx already manages ESC priority for all modals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
import { Check, Copy, Link2, X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useEscapeKey } from "../hooks/useEscapeKey";
|
||||
|
||||
export interface ShareDialogProps {
|
||||
show: boolean;
|
||||
@@ -44,7 +43,7 @@ export function ShareDialog({
|
||||
const closeLabel = t("common.close");
|
||||
const copyLabel = shareCopied ? t("share.copied") : t("share.copyLink");
|
||||
|
||||
useEscapeKey(show, onClose);
|
||||
// ESC is handled by the global handler in App.tsx to avoid double history.back()
|
||||
|
||||
if (!show) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user