@@ -48,6 +48,7 @@ interface NestedChecklistItemProps {
4848 overPosition ?: "before" | "after" ;
4949 isAnyItemDragging ?: boolean ;
5050 overItem ?: { id : string ; position : "before" | "after" } | null ;
51+ draggedItemId ?: string ;
5152}
5253
5354const NestedChecklistItemComponent = ( {
@@ -68,6 +69,7 @@ const NestedChecklistItemComponent = ({
6869 overPosition,
6970 isAnyItemDragging = false ,
7071 overItem = null ,
72+ draggedItemId,
7173} : NestedChecklistItemProps ) => {
7274 const t = useTranslations ( ) ;
7375 const { usersPublicData, user } = useAppMode ( ) ;
@@ -239,13 +241,16 @@ const NestedChecklistItemComponent = ({
239241 }
240242 } , [ item . children , hasChildren ] ) ;
241243
244+ const isBeingDragged = draggedItemId === item . id ;
245+
242246 return (
243247 < Droppable
244248 id = { `drop-into-item::${ item . id } ` }
245249 data = { {
246250 type : "item" ,
247251 itemId : item . id ,
248252 } }
253+ disabled = { isBeingDragged }
249254 >
250255 { ( { isOver : isOverDroppable } ) => (
251256 < div
@@ -397,7 +402,7 @@ const NestedChecklistItemComponent = ({
397402 size = "sm"
398403 onClick = { ( ) => setShowAddSubItem ( ! showAddSubItem ) }
399404 className = "h-8 w-8 p-0"
400- title = { t ( "checklists.addSubItem" ) }
405+ aria-label = { t ( "checklists.addSubItem" ) }
401406 >
402407 < Add01Icon className = "h-4 w-4" />
403408 </ Button >
@@ -409,6 +414,7 @@ const NestedChecklistItemComponent = ({
409414 size = "sm"
410415 onClick = { handleEdit }
411416 className = "h-8 w-8 p-0"
417+ aria-label = { t ( "common.edit" ) }
412418 >
413419 < PencilEdit02Icon className = "h-4 w-4" />
414420 </ Button >
@@ -420,6 +426,7 @@ const NestedChecklistItemComponent = ({
420426 size = "sm"
421427 onClick = { ( ) => onDelete ( item . id ) }
422428 className = "h-8 w-8 p-0"
429+ aria-label = { t ( "common.delete" ) }
423430 >
424431 < Delete03Icon className = "h-4 w-4" />
425432 </ Button >
@@ -434,6 +441,7 @@ const NestedChecklistItemComponent = ({
434441 size = "sm"
435442 onClick = { handleDropdownToggle }
436443 className = "h-8 w-8 p-0"
444+ aria-label = { t ( "common.moreOptions" ) }
437445 >
438446 < MoreHorizontalIcon className = "h-4 w-4" />
439447 </ Button >
@@ -473,6 +481,7 @@ const NestedChecklistItemComponent = ({
473481 size = "sm"
474482 onClick = { ( ) => setIsExpanded ( ! isExpanded ) }
475483 className = "h-6 w-6 p-0"
484+ aria-label = { isExpanded ? t ( "common.collapseAll" ) : t ( "common.expandAll" ) }
476485 >
477486 { isExpanded ? (
478487 < ArrowDown01Icon className = "h-4 w-4" />
@@ -508,7 +517,7 @@ const NestedChecklistItemComponent = ({
508517 size = "sm"
509518 disabled = { ! newSubItemText . trim ( ) }
510519 className = "h-8 w-8 p-0"
511- title = { t ( "common.add" ) }
520+ aria-label = { t ( "common.add" ) }
512521 >
513522 < Add01Icon className = "h-4 w-4" />
514523 </ Button >
@@ -521,6 +530,7 @@ const NestedChecklistItemComponent = ({
521530 setNewSubItemText ( "" ) ;
522531 } }
523532 className = "h-8 w-8 p-0"
533+ aria-label = { t ( "common.close" ) }
524534 >
525535 < MultiplicationSignIcon className = "h-4 w-4" />
526536 </ Button >
@@ -530,17 +540,19 @@ const NestedChecklistItemComponent = ({
530540
531541 { hasChildren && isExpanded && (
532542 < div className = { cn ( "pt-1" ) } >
533- < DropIndicator
534- id = { `drop-before-child::${
535- item . children ! [ 0 ] ?. id || `${ item . id } -start`
536- } `}
537- data = { {
538- type : "drop-indicator" ,
539- position : "before" ,
540- targetId : item . children ! [ 0 ] ?. id ,
541- parentId : item . id ,
542- } }
543- />
543+ { draggedItemId !== item . id && (
544+ < DropIndicator
545+ id = { `drop-before-child::${
546+ item . children ! [ 0 ] ?. id || `${ item . id } -start`
547+ } `}
548+ data = { {
549+ type : "drop-indicator" ,
550+ position : "before" ,
551+ targetId : item . children ! [ 0 ] ?. id ,
552+ parentId : item . id ,
553+ } }
554+ />
555+ ) }
544556 { item . children ! . map ( ( child , childIndex ) => (
545557 < div key = { child . id } >
546558 < NestedChecklistItem
@@ -552,7 +564,7 @@ const NestedChecklistItemComponent = ({
552564 onEdit = { onEdit }
553565 onAddSubItem = { onAddSubItem }
554566 isDeletingItem = { isDeletingItem }
555- isDragDisabled = { isDragDisabled }
567+ isDragDisabled = { isDragDisabled || draggedItemId === item . id }
556568 isPublicView = { isPublicView }
557569 checklist = { checklist }
558570 isOver = { overItem ?. id === child . id }
@@ -561,16 +573,19 @@ const NestedChecklistItemComponent = ({
561573 }
562574 isAnyItemDragging = { isAnyItemDragging }
563575 overItem = { overItem }
576+ draggedItemId = { draggedItemId }
564577 />
565- < DropIndicator
566- id = { `drop-after-child::${ child . id } ` }
567- data = { {
568- type : "drop-indicator" ,
569- position : "after" ,
570- targetId : child . id ,
571- parentId : item . id ,
572- } }
573- />
578+ { draggedItemId !== item . id && (
579+ < DropIndicator
580+ id = { `drop-after-child::${ child . id } ` }
581+ data = { {
582+ type : "drop-indicator" ,
583+ position : "after" ,
584+ targetId : child . id ,
585+ parentId : item . id ,
586+ } }
587+ />
588+ ) }
574589 </ div >
575590 ) ) }
576591 </ div >
0 commit comments