Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yomotsu committed Jan 28, 2025
1 parent d4dcba3 commit 4424ddf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/components/ContextMenu2/ContextMenu2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ export const ContextMenu2 = forwardRef<HTMLButtonElement, ContextMenu2Props>(
({ open, trigger, width, children, onOpenChange }, ref) => {
const { isRoot } = useContext(ContextMenu2Context);
const [isOpen, setIsOpen] = useState(false);
// ドラッグで移動できるパーツ(Sortable)を children として持っている場合は、
// 通常では、パネル外にカーソルが出ると自動で自パネルを閉じる。
// 一方で、ドラッグで移動できるパーツ(Sortable)を children として持っている場合は、
// ドラッグ時にパネル外にカーソルが出てしまう時がある。
// その時にパネルを閉じてしまうと、操作感として残念なので、
// ドラッグ中にマウスアウトしても閉じないようにするためのフラグ
Expand Down Expand Up @@ -274,10 +275,7 @@ export const ContextMenu2 = forwardRef<HTMLButtonElement, ContextMenu2Props>(
>
<ContextMenu2Context.Provider value={{ isRoot: false }}>
<ContextMenu2SortableContext.Provider
value={{
isSorting: isSorting,
setIsSorting: setIsSorting,
}}
value={{ isSorting, setIsSorting }}
>
{/*
上下矢印キーでメニュー内の項目を操作できるようにする
Expand Down
1 change: 0 additions & 1 deletion src/components/ContextMenu2/ContextMenu2SortableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const ContextMenu2SortableGroup = ({
!("displayName" in child.type) ||
child?.type?.displayName !== "ContextMenu2SortableItem"
) {
// ContextMenu2SortableItem 以外は受け付けない
throw new Error(
"ContextMenu2SortableContainer には ContextMenu2SortableItem しか入れられません",
);
Expand Down

0 comments on commit 4424ddf

Please sign in to comment.