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 numberDiff line numberDiff line change
Expand Up@@ -48,3 +48,6 @@
## 2024-08-01 - 네이티브 브라우저 UI의 다크 모드 지원 강제
**학습:** CSS 미디어 쿼리(`@media (prefers-color-scheme: dark)`)를 통해 다크 모드를 지원하더라도, 브라우저의 네이티브 UI 요소(스크롤바, 기본 폼 컨트롤, 기본 백그라운드 등)는 테마 변경을 인식하지 못해 어두운 테마 환경에서 밝은 스크롤바가 표시되는 등 시각적 불일치를 초래합니다.
**조치:** 항상 HTML 문서의 `<head>` 영역에 `<meta name="color-scheme" content="light dark">` 메타 태그를 명시적으로 추가하여 브라우저 수준에서 사용자의 시스템 테마(다크 모드 등)를 완전히 상속받아 일관성 있는 네이티브 UI를 렌더링하도록 보장하십시오.
## 2026-07-14 - Root Directory Empty Title Fix
**Learning:** In Java/Kotlin `java.io.File`, `getName()` returns an empty string for the filesystem root directory (e.g., `/`). When generating HTML listings, this results in empty `<title>` and `<h1>` tags, which causes a significant accessibility and UX failure.
**Action:** When using directory names for UI elements or semantic attributes, always verify if the name is empty and provide a clear, descriptive fallback (like `absolutePath`) for root paths.
4 changes: 2 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line numberDiff line numberDiff line change
Expand Up@@ -327,12 +327,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()}</title>
<title>${if (curr_dir.name.isEmpty()) "루트 디렉토리" else curr_dir.name.escapeHtml()}</title>
${css}
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${if (curr_dir.name.isEmpty()) "루트 디렉토리" else curr_dir.name.escapeHtml()}</h1>
<nav aria-label="디렉토리 목록">
<ul role="list">
<li><a class="dir-link" href="./.." aria-label="상위 디렉토리로 이동" title="상위 디렉토리로 이동"><span class="icon" aria-hidden="true">&#x21B0;</span> <span>..</span></a></li>
Expand Down
12 changes: 12 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line numberDiff line numberDiff line change
Expand Up@@ -414,6 +414,18 @@ class MainTest {
}
}

@Test
fun testRootDirectoryUXFallback() {
val mockRoot = object : java.io.File(tempDir.absolutePath) {
override fun getName(): String = ""
}
process_dir(mockRoot)
val indexFile = java.io.File(tempDir, "index.html")
val htmlContent = indexFile.readText()
assertTrue(htmlContent.contains("<title>루트 디렉토리</title>"))
assertTrue(htmlContent.contains("<h1>루트 디렉토리</h1>"))
}

@Test
fun testGoWithMaxLevel() {
val subdir = File(tempDir, "subdir")
Expand Down
Loading