Skip to content

Commit

Permalink
fix: figma close on escape (#46)
Browse files Browse the repository at this point in the history
* fix: figma close on escape

* fix: figma close on escape
  • Loading branch information
stepan662 authored Jun 17, 2024
1 parent 4360e46 commit dcdabd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/ui/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export const Dialog = ({ children, onClose }: Props) => {
useWindowSize(DEFAULT_SIZE);

useEffect(() => {
const handler = () => onClose();
const handler = (e: KeyboardEvent) => {
if (e.code === "Escape") {
onClose();
}
};
ref.current?.focus();
ref.current?.addEventListener("keydown", handler);
return () => ref.current?.removeEventListener("keydown", handler);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/Index/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const Index = () => {

return (
<div className={styles.container} style={{ height: size.height }}>
{selectionLoadable.isFetching && <FullPageLoading />}
{selectionLoadable.isFetching && <FullPageLoading blocking={false} />}
<div>
<Container
space="medium"
Expand Down

0 comments on commit dcdabd4

Please sign in to comment.