Permissions popup context iso

This commit is contained in:
Josh Perez 2021-09-17 18:24:21 -04:00 committed by GitHub
parent f3715411c6
commit 7b5faa1cc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 562 additions and 506 deletions

View file

@ -33,6 +33,7 @@ import {
DEFAULT_DURATIONS_SET,
format as formatExpirationTimer,
} from '../util/expirationTimer';
import { useEscapeHandling } from '../hooks/useEscapeHandling';
type CheckboxChangeHandlerType = (value: boolean) => unknown;
type SelectChangeHandlerType<T = string | number> = (value: T) => unknown;
@ -280,21 +281,7 @@ export const Preferences = ({
doneRendering();
}, [doneRendering]);
useEffect(() => {
const handler = (event: KeyboardEvent) => {
if (event.key === 'Escape') {
closeSettings();
event.preventDefault();
event.stopPropagation();
}
};
document.addEventListener('keydown', handler);
return () => {
document.removeEventListener('keydown', handler);
};
}, [closeSettings]);
useEscapeHandling(closeSettings);
const onZoomSelectChange = useCallback(
(value: string) => {