From 5b17beb16089f4237eb5efe7d9004d713114a3a9 Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Fri, 24 Jul 2026 03:39:39 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=B9=88=20=EB=94=94?=
=?UTF-8?q?=EB=A0=89=ED=86=A0=EB=A6=AC=20=EC=9D=B4=EB=A6=84(=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20=EB=93=B1)?=
=?UTF-8?q?=20=ED=8F=B4=EB=B0=B1=20=EC=B2=98=EB=A6=AC=EB=A1=9C=20=EC=A0=91?=
=?UTF-8?q?=EA=B7=BC=EC=84=B1=20=ED=96=A5=EC=83=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
디렉토리 이름이 비어 있을 때(예: 파일시스템 루트) 절대 경로를 사용하도록 폴백을 추가하여, 빈
과
태그가 스크린 리더 사용자에게 컨텍스트를 제공하지 못하는 접근성 문제를 해결했습니다. 빈 이름을 방지함으로써 스크린 리더가 내비게이션 트리의 현재 위치를 올바르게 읽을 수 있도록 보장합니다.
---
.jules/palette.md | 4 ++++
src/main/kotlin/html4tree/main.kt | 4 ++--
src/test/kotlin/html4tree/MainTest.kt | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 9a12c9d..472c07a 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -48,3 +48,7 @@
## 2024-08-01 - 네이티브 브라우저 UI의 다크 모드 지원 강제
**학습:** CSS 미디어 쿼리(`@media (prefers-color-scheme: dark)`)를 통해 다크 모드를 지원하더라도, 브라우저의 네이티브 UI 요소(스크롤바, 기본 폼 컨트롤, 기본 백그라운드 등)는 테마 변경을 인식하지 못해 어두운 테마 환경에서 밝은 스크롤바가 표시되는 등 시각적 불일치를 초래합니다.
**조치:** 항상 HTML 문서의 `` 영역에 `` 메타 태그를 명시적으로 추가하여 브라우저 수준에서 사용자의 시스템 테마(다크 모드 등)를 완전히 상속받아 일관성 있는 네이티브 UI를 렌더링하도록 보장하십시오.
+
+## 2026-07-24 - Handle empty directory names gracefully
+**Learning:** When generating HTML for a directory listing, if the directory name is empty (which happens at the root of a filesystem, e.g., `/` on Unix), using `File.getName()` results in an empty `` and `
`. This damages accessibility as screen readers and users lack context.
+**Action:** Always provide a fallback string, such as `File.absolutePath`, when evaluating the directory name for title or heading text so that empty nodes are avoided.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index b455862..1c3c2ee 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -327,12 +327,12 @@ ${cssContent}
- ${curr_dir.getName().escapeHtml()}
+ ${curr_dir.name.ifEmpty { curr_dir.absolutePath }.escapeHtml()}
${css}
-