Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-10-25 - 디렉토리 λ·°μ–΄μ˜ μ ‘κ·Όμ„± ν–₯상 (Accessibility improvement in Directory Viewer)
**Learning:** μž₯μ‹μš© μ•„μ΄μ½˜(예: 폴더 이λͺ¨μ§€λ‚˜ ν™”μ‚΄ν‘œ)이 슀크린 λ¦¬λ”μ—μ„œ 읽히면 μ‹œκ° μž₯μ• μΈμ—κ²Œ λΆˆν•„μš”ν•œ ν˜Όλž€(λ…Έμ΄μ¦ˆ)을 쀄 수 있으며, λͺ©λ‘μ„ 탐색할 λ•Œ λžœλ“œλ§ˆν¬(main)와 μ ‘κ·Όμ„± 이름(aria-label)이 μžˆλŠ” λ„€λΉ„κ²Œμ΄μ…˜ μš”μ†Œ(nav)λ₯Ό μ œκ³΅ν•΄μ•Ό 전체 ꡬ쑰λ₯Ό μ΄ν•΄ν•˜κΈ° μ‰½μŠ΅λ‹ˆλ‹€.
**Action:** μž₯μ‹μš© λ¬ΈμžλŠ” λ°˜λ“œμ‹œ `<span aria-hidden="true">`둜 감싸고, μ£Όμš” 탐색 μš”μ†ŒλŠ” μ‹œλ§¨ν‹± νƒœκ·Έ(nav, main)와 μ μ ˆν•œ `aria-label`을 μ‚¬μš©ν•˜μ—¬ λ¬ΆλŠ” νŒ¨ν„΄μ„ ν‘œμ€€μœΌλ‘œ μ μš©ν•©λ‹ˆλ‹€.
14 changes: 9 additions & 5 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ fun process_dir(curr_dir: File){
${css}
</head>
<body>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<ul>
<li><a style="display:block; width:100%" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동">&#x21B0; ..</a></li>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<nav aria-label="디렉토리 λͺ©λ‘">
<ul>
<li><a style="display:block; width:100%" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동"><span aria-hidden="true">&#x21B0;</span> ..</a></li>
"""

val index_middle = fun():String{
Expand All @@ -131,15 +133,17 @@ fun process_dir(curr_dir: File){
dir_files.forEach {
val isLinkedDirectory = it.isDirectory() && !java.nio.file.Files.isSymbolicLink(it.toPath())
if((it.getName() !in exclude) && (isLinkedDirectory || !it.isDirectory())) {
l += """ <li><a style="display:block; width:100%" href="${if (isLinkedDirectory) { "./${it.getName().urlEncodePath()}/" } else { "./${it.getName().urlEncodePath()}" }}">${if (isLinkedDirectory) { "&#128193;" } else { "&rtrif;" }} ${it.getName().escapeHtml()}</a></li>"""+"\n"
l += """ <li><a style="display:block; width:100%" href="${if (isLinkedDirectory) { "./${it.getName().urlEncodePath()}/" } else { "./${it.getName().urlEncodePath()}" }}"><span aria-hidden="true">${if (isLinkedDirectory) { "&#128193;" } else { "&rtrif;" }}</span> ${it.getName().escapeHtml()}</a></li>"""+"\n"
}
}

return l;
}

val index_bottom="""
</ul>
</ul>
</nav>
</main>
</body>
</html>
"""
Expand Down
5 changes: 5 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ class MainTest {
assertTrue(indexFile.exists())
val htmlContent = indexFile.readText()
assertTrue(htmlContent.contains("<html lang=\"ko\">"))
assertTrue(htmlContent.contains("<main>"))
assertTrue(htmlContent.contains("<nav aria-label=\"디렉토리 λͺ©λ‘\">"))
assertTrue(htmlContent.contains("aria-label=\"μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동\""))
assertTrue(htmlContent.contains("<span aria-hidden=\"true\">&#x21B0;</span>"))
assertTrue(htmlContent.contains("<span aria-hidden=\"true\">&rtrif;</span>"))
assertTrue(htmlContent.contains("<span aria-hidden=\"true\">&#128193;</span>"))
assertTrue(htmlContent.contains("file1.txt"))
assertTrue(htmlContent.contains("subdir/"))
assertTrue(htmlContent.contains("&#128193;"))
Expand Down