From bce32798da4d9ddd25bb9b24bbb1cf8329a7edeb Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Fri, 17 Jul 2026 03:33:58 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=B9=88=20=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20=EC=9D=B4?=
=?UTF-8?q?=EB=A6=84=EC=9D=84=20=EC=9C=84=ED=95=9C=20=ED=83=80=EC=9D=B4?=
=?UTF-8?q?=ED=8B=80=20=EB=B0=8F=20h1=20=ED=8F=B4=EB=B0=B1=20=EB=A1=9C?=
=?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
๐ก What: ๋๋ ํ ๋ฆฌ ์ด๋ฆ์ด ๋น์ด ์์ ๋(์: ํ์ผ ์์คํ
๋ฃจํธ) ์ ๋ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํ๋๋ก ํด๋ฐฑ ๋ก์ง ์ถ๊ฐ.
๐ฏ Why: ๋ฃจํธ ๋๋ ํ ๋ฆฌ ํ๊ฐ ์ ๋น ๋ฌธ์์ด์ด ๋ฐํ๋์ด ๋น
๋ฐ ํ๊ทธ๊ฐ ์์ฑ๋๋ ํ์์ ์์ .
๐ธ Before/After: Before: . After: /absolute/path /absolute/path
.
โฟ Accessibility: ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ ๋ํ ๋น ์ ๊ทผ์ฑ ์ด๋ฆ์ ๋ฐฉ์งํ์ฌ ์คํฌ๋ฆฐ ๋ฆฌ๋๊ฐ ์ฌ๋ฐ๋ฅธ ์ปจํ
์คํธ๋ฅผ ์ฝ์ ์ ์๋๋ก ํ์ฉ.
---
.jules/palette.md | 3 +++
src/main/kotlin/html4tree/main.kt | 7 +++++--
src/test/kotlin/html4tree/MainTest.kt | 17 +++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 9a12c9d..f206232 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -48,3 +48,6 @@
## 2024-08-01 - ๋ค์ดํฐ๋ธ ๋ธ๋ผ์ฐ์ UI์ ๋คํฌ ๋ชจ๋ ์ง์ ๊ฐ์
**ํ์ต:** CSS ๋ฏธ๋์ด ์ฟผ๋ฆฌ(`@media (prefers-color-scheme: dark)`)๋ฅผ ํตํด ๋คํฌ ๋ชจ๋๋ฅผ ์ง์ํ๋๋ผ๋, ๋ธ๋ผ์ฐ์ ์ ๋ค์ดํฐ๋ธ UI ์์(์คํฌ๋กค๋ฐ, ๊ธฐ๋ณธ ํผ ์ปจํธ๋กค, ๊ธฐ๋ณธ ๋ฐฑ๊ทธ๋ผ์ด๋ ๋ฑ)๋ ํ
๋ง ๋ณ๊ฒฝ์ ์ธ์ํ์ง ๋ชปํด ์ด๋์ด ํ
๋ง ํ๊ฒฝ์์ ๋ฐ์ ์คํฌ๋กค๋ฐ๊ฐ ํ์๋๋ ๋ฑ ์๊ฐ์ ๋ถ์ผ์น๋ฅผ ์ด๋ํฉ๋๋ค.
**์กฐ์น:** ํญ์ HTML ๋ฌธ์์ `` ์์ญ์ `` ๋ฉํ ํ๊ทธ๋ฅผ ๋ช
์์ ์ผ๋ก ์ถ๊ฐํ์ฌ ๋ธ๋ผ์ฐ์ ์์ค์์ ์ฌ์ฉ์์ ์์คํ
ํ
๋ง(๋คํฌ ๋ชจ๋ ๋ฑ)๋ฅผ ์์ ํ ์์๋ฐ์ ์ผ๊ด์ฑ ์๋ ๋ค์ดํฐ๋ธ UI๋ฅผ ๋ ๋๋งํ๋๋ก ๋ณด์ฅํ์ญ์์ค.
+## 2026-07-17 - Fallback for Empty Root Directory Name
+**Learning:** When navigating to the filesystem root, the directory name evaluates to an empty string, which results in empty and elements. This creates a severe accessibility issue where screen readers cannot announce the page context.
+**Action:** Always provide a fallback (like absolutePath) when dealing with directory names that might evaluate to empty strings to preserve a11y semantic names.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index b455862..5b21876 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -317,6 +317,9 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
${cssContent}
"""
+ val dirNameRaw = curr_dir.getName()
+ val dirName = if (dirNameRaw.isEmpty()) curr_dir.getAbsolutePath() else dirNameRaw
+
val index_top = """
@@ -327,12 +330,12 @@ ${cssContent}
- ${curr_dir.getName().escapeHtml()}
+ ${dirName.escapeHtml()}
${css}
- ${curr_dir.getName().escapeHtml()}
+ ${dirName.escapeHtml()}