diff --git a/.jules/palette.md b/.jules/palette.md index 7b223901..f660851f 100644 --- a/.jules/palette.md +++ b/.jules/palette.md @@ -52,3 +52,7 @@ ## 2024-07-13 - 빈 디렉토리 상태의 접근성(Accessibility) 개선 **Learning:** 정적 파일 서버의 빈 디렉토리 상태는 스크린 리더 사용자에게 컨텐츠 누락으로 오해받을 수 있으며, 시각적으로도 일반 리스트 아이템과 정렬이 맞지 않는 문제가 있었습니다. **Action:** 빈 상태를 나타내는 요소에 `role="status"`를 추가하여 스크린 리더가 명확하게 인지할 수 있도록 하고, 아이콘과 flex 레이아웃을 통해 다른 리스트 아이템과 일관된 시각적 흐름을 제공하도록 합니다. + +## 2026-08-08 - 빈 루트 디렉토리 이름의 접근성 개선 +**학습:** 파일 시스템의 루트 디렉토리(예: `/`)에서 `File.getName()`을 호출하면 빈 문자열이 반환되어 생성된 HTML에 빈 ``과 `<h1>`이 발생합니다. 이는 스크린 리더 사용자에게 컨텍스트를 제공하지 못해 접근성을 저하시킵니다. +**조치:** 디렉토리 이름이 빈 문자열인 경우 시각적인 폴백(예: `/`)을 명시적으로 제공하여 항상 유효하고 접근 가능한 제목과 헤딩 태그를 생성하도록 하십시오. diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt index f52a1468..a34cefab 100644 --- a/src/main/kotlin/html4tree/main.kt +++ b/src/main/kotlin/html4tree/main.kt @@ -326,6 +326,7 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array val exclude: Set<String> = excludeSet ?: process_ignore_file(curr_dir) + val displayDirName = if (curr_dir.getName().isEmpty()) "/" else curr_dir.getName() val index_top = """<!doctype html> <html lang="ko"> <head> @@ -336,12 +337,12 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src '${STYLE_HASH}'; base-uri 'none'; form-action 'none';"> <!-- 보안 향상: 리퍼러를 통한 디렉토리 경로 노출 방지 --> <meta name="referrer" content="no-referrer"> - <title>${curr_dir.getName().escapeHtml()} + ${displayDirName.escapeHtml()}
-

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

+

${displayDirName.escapeHtml()}