Skip to content
Draft
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@
## 2026-08-17 - 브라우저 번역과 화면 판독기의 호환성을 위한 텍스트 처리
**Learning:** `aria-label` 속성으로 지정된 화면 판독기용 대체 텍스트는 Chrome Translate 등 브라우저 번역 도구에 의해 번역되지 않는 경우가 많습니다. 이로 인해 문서 언어가 변환되어도 스크린 리더에서는 원본 언어(예: 영어)로 읽혀 다국어 접근성이 저하됩니다.
**Action:** 화면 판독기를 위한 숨겨진 설명 텍스트를 제공할 때 `aria-label` 대신 CSS `.visually-hidden` 클래스를 적용한 `<span>` 요소를 사용하여, 브라우저가 일반 텍스트로 인식하고 번역할 수 있도록 하여 다국어 접근성 호환성을 확보하십시오.

## 2024-08-20 - 동적 사용자 입력 텍스트의 양방향 텍스트(BiDi) 지원
**학습:** 파일 및 디렉토리 이름과 같은 사용자 제어 텍스트는 아랍어, 히브리어 등 양방향 텍스트(BiDi)가 혼합될 수 있습니다. 방향성 지정 없이 렌더링하면 브라우저의 기본 방향(LTR)을 따르기 때문에 레이아웃과 텍스트 순서가 깨질 수 있습니다.
**조치:** 파일 이름이나 디렉토리 이름 등 사용자 제어 텍스트가 삽입되는 HTML 요소(`<title>`, `<h1>`, 텍스트 컨테이너 등)에는 항상 `dir="auto"` 속성을 추가하여 브라우저가 콘텐츠 자체를 분석하여 올바른 텍스트 방향을 결정하도록 하십시오.
6 changes: 3 additions & 3 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,12 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array
<!-- 보안 향상: 리퍼러를 통한 디렉토리 경로 노출 방지 -->
<meta name="referrer" content="no-referrer">
<meta name="robots" content="noindex, nofollow">
<title>${directoryName.escapeHtml()} - 디렉토리 목록</title>
<title dir="auto">${directoryName.escapeHtml()} - 디렉토리 목록</title>
<style>${CSS_CONTENT}</style>
</head>
<body>
<main>
<h1>${directoryName.escapeHtml()}</h1>
<h1 dir="auto">${directoryName.escapeHtml()}</h1>
<nav aria-label="디렉토리 목록">
<ul role="list">
<li><a class="dir-link" href="./.." title="상위 디렉토리로 이동"><span class="icon" aria-hidden="true">&#x21B0;</span> <span aria-hidden="true">..</span> <span class="visually-hidden">상위 디렉토리로 이동</span></a></li>
Expand Down Expand Up @@ -460,7 +460,7 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array
val ariaLabel = "${fileName} ${if (isLinkedDirectory) { "디렉토리" } else { "파일" }}".escapeHtml()
val typeLabel = if (isLinkedDirectory) { "디렉토리" } else { "파일" }
val icon = if (isLinkedDirectory) { "&#128193;" } else { "&#128196;" }
l.append(""" <li><a class="dir-link" href="${encodedHref}" title="${ariaLabel}"><span class="icon" aria-hidden="true">${icon}</span> <span>${fileName.escapeHtml()}</span> <span class="visually-hidden">${typeLabel}</span></a></li>""")
l.append(""" <li><a class="dir-link" href="${encodedHref}" title="${ariaLabel}"><span class="icon" aria-hidden="true">${icon}</span> <span dir="auto">${fileName.escapeHtml()}</span> <span class="visually-hidden">${typeLabel}</span></a></li>""")
l.append('\n')
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ class MainTest {
val indexHtml = File(fakeRoot, "index.html")
assertTrue(indexHtml.exists())
val content = indexHtml.readText()
assertTrue(content.contains("<title>Root - 디렉토리 목록</title>"))
assertTrue(content.contains("<h1>Root</h1>"))
assertTrue(content.contains("<title dir=\"auto\">Root - 디렉토리 목록</title>"))
assertTrue(content.contains("<h1 dir=\"auto\">Root</h1>"))
}

}
Loading