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: ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ ํ‰๊ฐ€ ์‹œ ๋นˆ ๋ฌธ์ž์—ด์ด ๋ฐ˜ํ™˜๋˜์–ด ๋นˆ ๋ฐ <h1> ํƒœ๊ทธ๊ฐ€ ์ƒ์„ฑ๋˜๋Š” ํ˜„์ƒ์„ ์ˆ˜์ •. ๐Ÿ“ธ Before/After: Before: <title>

. 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 <h1> 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<String>? = null, dirFiles: Array ${cssContent} </style> """ + val dirNameRaw = curr_dir.getName() + val dirName = if (dirNameRaw.isEmpty()) curr_dir.getAbsolutePath() else dirNameRaw + val index_top = """<!doctype html> <html lang="ko"> <head> @@ -327,12 +330,12 @@ ${cssContent} </style> <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src '${styleHash}'; base-uri 'none'; form-action 'none';"> <!-- ๋ณด์•ˆ ํ–ฅ์ƒ: ๋ฆฌํผ๋Ÿฌ๋ฅผ ํ†ตํ•œ ๋””๋ ‰ํ† ๋ฆฌ ๊ฒฝ๋กœ ๋…ธ์ถœ ๋ฐฉ์ง€ --> <meta name="referrer" content="no-referrer"> - <title>${curr_dir.getName().escapeHtml()} + ${dirName.escapeHtml()} ${css}
-

${curr_dir.getName().escapeHtml()}

+

${dirName.escapeHtml()}