@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useLayoutEffect } from 'react';
22// Fix: Correctly import the DocumentOrFolder type.
33import type { DocumentOrFolder , DraggedNodeTransfer } from '../types' ;
44import IconButton from './IconButton' ;
5- import { FileIcon , FolderIcon , FolderOpenIcon , TrashIcon , ChevronRightIcon , ChevronDownIcon , CopyIcon , ArrowUpIcon , ArrowDownIcon , CodeIcon , SaveIcon , LockClosedIcon , LockOpenIcon } from './Icons' ;
5+ import { FileIcon , FolderIcon , FolderOpenIcon , ChevronRightIcon , ChevronDownIcon , CopyIcon , ArrowUpIcon , ArrowDownIcon , CodeIcon , LockClosedIcon , LockOpenIcon } from './Icons' ;
66import Tooltip from './Tooltip' ;
77
88export interface DocumentNode extends DocumentOrFolder {
@@ -30,11 +30,7 @@ interface DocumentTreeItemProps {
3030 onDropFiles : ( files : FileList , parentId : string | null ) => void ;
3131 onToggleExpand : ( id : string ) => void ;
3232 onCopyNodeContent : ( id : string ) => void ;
33- copyContentTooltip : string ;
34- onSaveNodeToFile : ( id : string ) => void ;
35- saveToFileTooltip : string ;
3633 onToggleLock : ( id : string , locked : boolean ) => void | Promise < void > ;
37- getToggleLockTooltip : ( locked : boolean ) => string ;
3834 isKnownNodeId : ( id : string ) => boolean ;
3935 searchTerm : string ;
4036 onMoveUp : ( id : string ) => void ;
@@ -117,11 +113,7 @@ const DocumentTreeItem: React.FC<DocumentTreeItemProps> = (props) => {
117113 onDropFiles,
118114 onToggleExpand,
119115 onCopyNodeContent,
120- copyContentTooltip,
121- onSaveNodeToFile,
122- saveToFileTooltip,
123116 onToggleLock,
124- getToggleLockTooltip,
125117 onMoveUp,
126118 onMoveDown,
127119 canMoveUp,
@@ -155,6 +147,7 @@ const DocumentTreeItem: React.FC<DocumentTreeItemProps> = (props) => {
155147 const isOpenInTab = ! isFolder && openDocumentIds . has ( node . id ) ;
156148 const areActionsVisible = isSelected || isFocused || isHovered ;
157149 const emojiForNode = ! isFolder ? extractEmoji ( node . title ) : null ;
150+ const lockAriaLabel = node . locked ? 'Unlock Document' : 'Lock Document' ;
158151 const displayTitle = React . useMemo ( ( ) => {
159152 if ( ! emojiForNode || isFolder ) {
160153 return node . title ;
@@ -463,23 +456,40 @@ const DocumentTreeItem: React.FC<DocumentTreeItemProps> = (props) => {
463456 overflow : areActionsVisible ? undefined : 'hidden' ,
464457 } }
465458 >
466- < IconButton onClick = { ( e ) => { e . stopPropagation ( ) ; onMoveUp ( node . id ) ; } } tooltip = "Move Up" size = "xs" variant = "ghost" disabled = { ! canMoveUp } >
459+ < IconButton
460+ aria-label = "Move Up"
461+ onClick = { ( e ) => { e . stopPropagation ( ) ; onMoveUp ( node . id ) ; } }
462+ size = "xs"
463+ variant = "ghost"
464+ disabled = { ! canMoveUp }
465+ >
467466 < ArrowUpIcon className = "w-3.5 h-3.5" />
468467 </ IconButton >
469- < IconButton onClick = { ( e ) => { e . stopPropagation ( ) ; onMoveDown ( node . id ) ; } } tooltip = "Move Down" size = "xs" variant = "ghost" disabled = { ! canMoveDown } >
468+ < IconButton
469+ aria-label = "Move Down"
470+ onClick = { ( e ) => { e . stopPropagation ( ) ; onMoveDown ( node . id ) ; } }
471+ size = "xs"
472+ variant = "ghost"
473+ disabled = { ! canMoveDown }
474+ >
470475 < ArrowDownIcon className = "w-3.5 h-3.5" />
471476 </ IconButton >
472477 { ! isFolder && (
473478 < >
474- < IconButton onClick = { ( e ) => { e . stopPropagation ( ) ; onCopyNodeContent ( node . id ) ; } } tooltip = { copyContentTooltip } size = "xs" variant = "ghost" >
479+ < IconButton
480+ aria-label = "Copy Content"
481+ onClick = { ( e ) => { e . stopPropagation ( ) ; onCopyNodeContent ( node . id ) ; } }
482+ size = "xs"
483+ variant = "ghost"
484+ >
475485 < CopyIcon className = "w-3.5 h-3.5" />
476486 </ IconButton >
477487 < IconButton
488+ aria-label = { lockAriaLabel }
478489 onClick = { ( e ) => {
479490 e . stopPropagation ( ) ;
480491 void onToggleLock ( node . id , ! node . locked ) ;
481492 } }
482- tooltip = { getToggleLockTooltip ( node . locked ) }
483493 size = "xs"
484494 variant = "ghost"
485495 className = { node . locked ? 'text-primary' : '' }
@@ -490,14 +500,8 @@ const DocumentTreeItem: React.FC<DocumentTreeItemProps> = (props) => {
490500 < LockOpenIcon className = "w-3.5 h-3.5" />
491501 ) }
492502 </ IconButton >
493- < IconButton onClick = { ( e ) => { e . stopPropagation ( ) ; onSaveNodeToFile ( node . id ) ; } } tooltip = { saveToFileTooltip } size = "xs" variant = "ghost" >
494- < SaveIcon className = "w-3.5 h-3.5" />
495- </ IconButton >
496503 </ >
497504 ) }
498- < IconButton onClick = { ( e ) => { e . stopPropagation ( ) ; onDeleteNode ( node . id , e . shiftKey ) ; } } tooltip = "Delete" size = "xs" variant = "destructive" >
499- < TrashIcon className = "w-3.5 h-3.5" />
500- </ IconButton >
501505 </ div >
502506 ) }
503507 </ div >
0 commit comments