From da274b9303be08d9f3b9d9d8ed452b0343a1103f Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Sat, 8 Aug 2026 03:18:11 +0000
Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=B9=88=20?=
=?UTF-8?q?=EB=A3=A8=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20?=
=?UTF-8?q?=EC=9D=B4=EB=A6=84=EC=9D=98=20=EC=A0=91=EA=B7=BC=EC=84=B1=20?=
=?UTF-8?q?=EA=B0=9C=EC=84=A0?=
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 | 5 +++--
src/test/kotlin/html4tree/MainTest.kt | 14 ++++++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 7b223901..f660851f 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -52,3 +52,7 @@
## 2024-07-13 - 빈 디렉토리 상태의 접근성(Accessibility) 개선
**Learning:** 정적 파일 서버의 빈 디렉토리 상태는 스크린 리더 사용자에게 컨텐츠 누락으로 오해받을 수 있으며, 시각적으로도 일반 리스트 아이템과 정렬이 맞지 않는 문제가 있었습니다.
**Action:** 빈 상태를 나타내는 요소에 `role="status"`를 추가하여 스크린 리더가 명확하게 인지할 수 있도록 하고, 아이콘과 flex 레이아웃을 통해 다른 리스트 아이템과 일관된 시각적 흐름을 제공하도록 합니다.
+
+## 2026-08-08 - 빈 루트 디렉토리 이름의 접근성 개선
+**학습:** 파일 시스템의 루트 디렉토리(예: `/`)에서 `File.getName()`을 호출하면 빈 문자열이 반환되어 생성된 HTML에 빈 `
`과 `
`이 발생합니다. 이는 스크린 리더 사용자에게 컨텍스트를 제공하지 못해 접근성을 저하시킵니다.
+**조치:** 디렉토리 이름이 빈 문자열인 경우 시각적인 폴백(예: `/`)을 명시적으로 제공하여 항상 유효하고 접근 가능한 제목과 헤딩 태그를 생성하도록 하십시오.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index f52a1468..a34cefab 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -326,6 +326,7 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
val exclude: Set = excludeSet ?: process_ignore_file(curr_dir)
+ val displayDirName = if (curr_dir.getName().isEmpty()) "/" else curr_dir.getName()
val index_top = """
@@ -336,12 +337,12 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
- ${curr_dir.getName().escapeHtml()}
+ ${displayDirName.escapeHtml()}
-