Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
import { useEffect } from "react";
/**
* Calls `onClose` when the Escape key is pressed while `active` is true.
*/
export function useEscapeKey(active: boolean, onClose: () => void) {
useEffect(() => {
if (!active) return;
const handler = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose();
};
document.addEventListener("keydown", handler);
return () => document.removeEventListener("keydown", handler);
}, [active, onClose]);
}