A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Fix sidebar drag-and-drop requiring click before drag (#7669)
Trevor Manz06ea2231d974
diff --git a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx b/frontend/src/components/editor/chrome/wrapper/sidebar.tsxindex c6dedc75e0..ddd01e6a53 100644--- a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx+++ b/frontend/src/components/editor/chrome/wrapper/sidebar.tsx@@ -63,12 +63,12 @@ export const Sidebar: React.FC = () => {)}ariaLabel="Reorderable sidebar panels"className="flex flex-col gap-0"+ onAction={(panel) => toggleApplication(panel.id)}renderItem={(panel) => {return (<SidebarItemtooltip={panel.tooltip}selected={selectedPanel === panel.id}- onClick={() => toggleApplication(panel.id)}>{renderIcon(panel)}</SidebarItem>@@ -115,26 +115,33 @@ const QueuedOrRunningStack = () => {};const SidebarItem: React.FC<- PropsWithChildren<- {- selected: boolean;- tooltip: React.ReactNode;- } & React.HTMLAttributes<HTMLButtonElement>- >-> = ({ children, tooltip, selected, className, ...rest }) => {+ PropsWithChildren<{+ selected: boolean;+ tooltip: React.ReactNode;+ className?: string;+ onClick?: () => void;+ }>+> = ({ children, tooltip, selected, className, onClick }) => {+ const itemClassName = cn(+ "flex items-center p-2 text-sm mx-px shadow-inset font-mono rounded",+ !selected && "hover:bg-(--sage-3)",+ selected && "bg-(--sage-4)",+ className,+ );++ // Render as div when not clickable (e.g., inside ReorderableList)+ // This avoids nested interactive elements which break react-aria's drag behavior+ const content = onClick ? (+ <button className={itemClassName} onClick={onClick}>+ {children}+ </button>+ ) : (+ <div className={itemClassName}>{children}</div>+ );+return (<Tooltip content={tooltip} side="right" delayDuration={200}>- <button- className={cn(- "flex items-center p-2 text-sm mx-px shadow-inset font-mono rounded",- !selected && "hover:bg-(--sage-3)",- selected && "bg-(--sage-4)",- className,- )}- {...rest}- >- {children}- </button>+ {content}</Tooltip>);};diff --git a/frontend/src/components/ui/reorderable-list.tsx b/frontend/src/components/ui/reorderable-list.tsxindex 8ac303dc13..10c6606e1c 100644--- a/frontend/src/components/ui/reorderable-list.tsx+++ b/frontend/src/components/ui/reorderable-list.tsx@@ -3,6 +3,7 @@import type React from "react";import { useMemo } from "react";import { ListBox, ListBoxItem, useDragAndDrop } from "react-aria-components";+import { Logger } from "@/utils/Logger";import {ContextMenu,ContextMenuCheckboxItem,@@ -21,9 +22,14 @@ export interface ReorderableListProps<T extends { id: string | number }> {*/setValue: (items: T[]) => void;/**- * Render function for each item+ * Render function for each item.+ * Note: Avoid interactive elements (buttons) inside - they break drag behavior.*/renderItem: (item: T) => React.ReactNode;+ /**+ * Callback when an item is clicked+ */+ onAction?: (item: T) => void;/*** All available items that can be added to the list*/@@ -71,6 +77,7 @@ export const ReorderableList = <T extends { id: string | number }>({value,setValue,renderItem,+ onAction,availableItems,getItemLabel = (item) => String(item.id),minItems = 1,@@ -112,13 +119,32 @@ export const ReorderableList = <T extends { id: string | number }>({}};+ const handleAction = (key: React.Key) => {+ if (!onAction) {+ return;+ }++ const item = value.find((i) => i.id === key);++ if (!item) {+ Logger.warn("handleAction: item not found for key", {+ key,+ availableIds: value.map((v) => v.id),+ });+ return;+ }++ onAction(item);+ };+const listBox = (<ListBoxaria-label={ariaLabel}- selectionMode="single"+ selectionMode="none"items={value}dragAndDropHooks={dragAndDropHooks}className={className}+ onAction={handleAction}>{(item) => (<ListBoxItem className="active:cursor-grabbing data-[dragging]:opacity-60">