fix: split category fetch, safe localStorage, aria-labels on icon buttons
- TreeLibraryPage: split categories into a mount-only fetch so filter changes only re-fetch trees (not categories every time) - Add safeGetItem/safeSetItem/safeRemoveItem helpers in utils.ts to prevent crashes in private browsing or when storage is unavailable - Replace raw localStorage calls in ScratchpadSidebar, TreeNavigationPage, TreeEditorPage, and treeEditorStore with safe wrappers - Add aria-label to 20 icon-only buttons across 8 component files for screen reader accessibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,7 @@ export function AddToFolderMenu({ treeId, onFolderCreated }: AddToFolderMenuProp
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Add to folder"
|
||||
aria-label="Add to folder"
|
||||
>
|
||||
<FolderPlus className="h-4 w-4" />
|
||||
</button>
|
||||
|
||||
@@ -85,6 +85,7 @@ export function TreeGridView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Fork tree"
|
||||
aria-label="Fork tree"
|
||||
>
|
||||
<GitBranch className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -97,6 +98,7 @@ export function TreeGridView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Edit tree"
|
||||
aria-label="Edit tree"
|
||||
>
|
||||
<Pencil className="h-4 w-4" />
|
||||
</Link>
|
||||
@@ -110,6 +112,7 @@ export function TreeGridView({
|
||||
'hover:bg-red-400/10 hover:text-red-400'
|
||||
)}
|
||||
title="Delete tree"
|
||||
aria-label="Delete tree"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</button>
|
||||
|
||||
@@ -88,6 +88,7 @@ export function TreeListView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Fork tree"
|
||||
aria-label="Fork tree"
|
||||
>
|
||||
<GitBranch className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -100,6 +101,7 @@ export function TreeListView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Edit tree"
|
||||
aria-label="Edit tree"
|
||||
>
|
||||
<Pencil className="h-4 w-4" />
|
||||
</Link>
|
||||
|
||||
@@ -192,6 +192,7 @@ export function TreeTableView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Fork tree"
|
||||
aria-label="Fork tree"
|
||||
>
|
||||
<GitBranch className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
@@ -204,6 +205,7 @@ export function TreeTableView({
|
||||
'hover:bg-white/10 hover:text-white'
|
||||
)}
|
||||
title="Edit tree"
|
||||
aria-label="Edit tree"
|
||||
>
|
||||
<Pencil className="h-3.5 w-3.5" />
|
||||
</Link>
|
||||
|
||||
@@ -22,6 +22,7 @@ export function ViewToggle({ view, onChange, className }: ViewToggleProps) {
|
||||
: 'text-white/50 hover:bg-white/[0.06] hover:text-white'
|
||||
)}
|
||||
title="Grid view"
|
||||
aria-label="Grid view"
|
||||
>
|
||||
<LayoutGrid className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -35,6 +36,7 @@ export function ViewToggle({ view, onChange, className }: ViewToggleProps) {
|
||||
: 'text-white/50 hover:bg-white/[0.06] hover:text-white'
|
||||
)}
|
||||
title="List view"
|
||||
aria-label="List view"
|
||||
>
|
||||
<List className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -48,6 +50,7 @@ export function ViewToggle({ view, onChange, className }: ViewToggleProps) {
|
||||
: 'text-white/50 hover:bg-white/[0.06] hover:text-white'
|
||||
)}
|
||||
title="Table view"
|
||||
aria-label="Table view"
|
||||
>
|
||||
<Table className="h-4 w-4" />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user