fix: address PR #1829 review findings in ChatHistorySidebar and paths

- Fix i18n: replace non-existent t('actions.cancel') with t('buttons.cancel')
  in all three AlertDialog cancel buttons (single delete, bulk delete, bulk archive)
- Fix WCAG: add aria-hidden and tabIndex={-1} to decorative inner Checkbox
  to eliminate nested checkbox role violation in selection mode
- Fix: move setBulkDeleteOpen/setBulkArchiveOpen to finally blocks so dialogs
  always close regardless of success or failure in bulk handlers
- Fix: remove unsanitized sessionId from validateSessionId error message
  to prevent leaking raw input in error output (paths.ts)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
AndyMik90
2026-02-18 15:07:03 +01:00
co-authored by Claude Opus 4.6
parent f47091588a
commit 4bb3d658d0
2 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export class InsightsPaths {
*/
private validateSessionId(sessionId: string): void {
if (!/^session-\d{1,20}$/.test(sessionId)) {
throw new Error(`Invalid session ID format: ${sessionId}`);
throw new Error('Invalid session ID format');
}
}
@@ -149,9 +149,10 @@ export function ChatHistorySidebar({
try {
await onDeleteSessions(Array.from(selectedIds));
setSelectedIds(new Set());
setBulkDeleteOpen(false);
} catch (error) {
console.error('Failed to delete sessions:', error);
} finally {
setBulkDeleteOpen(false);
}
}
};
@@ -167,9 +168,10 @@ export function ChatHistorySidebar({
try {
await onArchiveSessions(Array.from(selectedIds));
setSelectedIds(new Set());
setBulkArchiveOpen(false);
} catch (error) {
console.error('Failed to archive sessions:', error);
} finally {
setBulkArchiveOpen(false);
}
}
};
@@ -367,7 +369,7 @@ export function ChatHistorySidebar({
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t('actions.cancel')}</AlertDialogCancel>
<AlertDialogCancel>{t('buttons.cancel')}</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete}>{t('actions.delete')}</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -397,7 +399,7 @@ export function ChatHistorySidebar({
</div>
)}
<AlertDialogFooter>
<AlertDialogCancel>{t('actions.cancel')}</AlertDialogCancel>
<AlertDialogCancel>{t('buttons.cancel')}</AlertDialogCancel>
<AlertDialogAction onClick={handleBulkDelete}>
{t('insights.bulkDeleteConfirm', { count: selectedIds.size })}
</AlertDialogAction>
@@ -415,7 +417,7 @@ export function ChatHistorySidebar({
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t('actions.cancel')}</AlertDialogCancel>
<AlertDialogCancel>{t('buttons.cancel')}</AlertDialogCancel>
<AlertDialogAction onClick={handleBulkArchiveConfirmed}>
{t('insights.archiveConfirmButton', { count: selectedIds.size })}
</AlertDialogAction>
@@ -530,6 +532,8 @@ function SessionItem({
<Checkbox
checked={isSelected}
className="h-4 w-4"
aria-hidden
tabIndex={-1}
/>
</div>
) : (