Skip to content

Commit

Permalink
fix: cannot dnd in firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
ourongxing committed Nov 21, 2024
1 parent bf07610 commit 5af24c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/column/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ function NewsCard({ id, setHandleRef }: NewsCardProps) {
className={$("btn", isFocused ? "i-ph:star-fill" : "i-ph:star-duotone")}
onClick={toggleFocus}
/>
{/* firefox cannot drag a button */}
{setHandleRef && (
<button
<div
ref={setHandleRef}
type="button"
className={$("btn", "i-ph:dots-six-vertical-duotone", "cursor-grab")}
/>
)}
Expand Down
6 changes: 2 additions & 4 deletions src/components/common/dnd/useSortable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ export function useSortable(props: SortableProps) {
if (handleRef && nodeRef) {
const cleanup = combine(
draggable({
// use custom drag preview
element: handleRef,
// element: ref,
// dragHandle: handleRef,
element: nodeRef,
dragHandle: handleRef,
getInitialData: () => ({ id: props.id, instanceId }),
onGenerateDragPreview({ nativeSetDragImage, location }) {
setCustomNativeDragPreview({
Expand Down

0 comments on commit 5af24c8

Please sign in to comment.