Skip to content

Commit

Permalink
fix: stop propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Mar 16, 2024
1 parent e4809ee commit c83267f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/frontend/component/src/ui/editable/inline-edit.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import clsx from 'clsx';
import type {
CSSProperties,
ForwardedRef,
HTMLAttributes,
KeyboardEvent,
PropsWithChildren,
} from 'react';
import {
type CSSProperties,
type ForwardedRef,
type HTMLAttributes,
type KeyboardEvent,
type PropsWithChildren,
useCallback,
useEffect,
useImperativeHandle,
Expand Down Expand Up @@ -134,6 +136,7 @@ export const InlineEdit = ({
}, [submit]);

const onKeyDown = useCallback((e: KeyboardEvent<HTMLInputElement>) => {
e.stopPropagation();
if (!exitible) return;
if (e.key !== 'Escape') return;
inputRef.current?.blur();
Expand Down

0 comments on commit c83267f

Please sign in to comment.