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-06-25 - Hide decorative Unicode icons from screen readers in directory listings
**Learning:** Screen readers will unnecessarily announce Unicode characters like right-pointing triangles or folders if they are not explicitly hidden. In long directory listings, this creates massive auditory noise that slows down navigation.
**Action:** Always wrap decorative or duplicate-meaning Unicode symbols with `<span aria-hidden="true">...</span>` when used alongside text that already conveys the meaning, and use proper semantic landmarks like `<main>` to group primary content.
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ fun process_dir(curr_dir: File){
${css}
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<ul>
<li><a style="display:block; width:100%" href="./.." aria-label="μƒμœ„ λ””λ ‰ν† λ¦¬λ‘œ 이동">&#x21B0; ..</a></li>
<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,7 +132,7 @@ 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"
}
}

Expand All @@ -140,6 +141,7 @@ fun process_dir(curr_dir: File){

val index_bottom="""
</ul>
</main>
</body>
</html>
"""
Expand Down