From 8a415994667dab46d39d0bdecec3ac6e543e5a58 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 22 Feb 2023 13:28:01 +0800 Subject: [PATCH] Allow esc to close Account sheet --- src/components/account.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/account.jsx b/src/components/account.jsx index ea6ab6e1..73ed46be 100644 --- a/src/components/account.jsx +++ b/src/components/account.jsx @@ -1,6 +1,7 @@ import './account.css'; import { useEffect, useRef, useState } from 'preact/hooks'; +import { useHotkeys } from 'react-hotkeys-hook'; import { api } from '../utils/api'; import emojifyText from '../utils/emojify-text'; @@ -82,8 +83,11 @@ function Account({ account, instance: propInstance, onClose }) { username, } = info || {}; + const escRef = useHotkeys('esc', onClose, [onClose]); + return (