aria-hidden 및 aria-live
장식용 요소를 숨기고 동적 콘텐츠를 스크린 리더에 알리기
aria-hidden 및 aria-live은(는) CoddyKit의 무료 HTML Academy 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 HTML Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. HTML Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
aria-hidden
aria-hidden="true"는 요소를 접근성 트리에서 제거하므로 화면 낭독기가 완전히 건너뜁니다:
<!-- Decorative icon: visible but skip by screen readers -->
<span aria-hidden="true">★★★★☆</span>
<span class="sr-only">4 out of 5 stars</span>
<!-- Decorative separator -->
<img src="divider.svg" alt="" aria-hidden="true">
<!-- Note: aria-hidden does NOT affect visibility or tab focus
A button with aria-hidden is still tabbable! -->aria-hidden 사용 사례
aria-hidden을 사용하기에 적절한 경우:
<!-- 1. Icons next to descriptive text -->
<button>
<svg aria-hidden="true"><!-- icon --></svg>
Save Document
</button>
<!-- 2. Repeated text in a card link -->
<a href="/blog/post-1">
<span aria-hidden="true">Read more</span>
<span class="sr-only">Read more: HTML5 Forms Guide</span>
</a>
<!-- 3. UI decoration (dots, decorative borders) -->
<span aria-hidden="true">•••</span>aria-hidden 사용 시 주의점
포커스를 받을 수 있는 요소에는 aria-hidden을 절대 적용하지 마십시오:
<!-- BAD: button is in tab order but invisible to screen readers -->
<button aria-hidden="true">Close</button>
<!-- Users reach this via Tab but hear nothing
They cannot tell if they're on a button or lost focus -->
<!-- If you want to hide from both: use hidden attribute -->
<button hidden>Close</button>
<!-- Or: disabled (but disabled removes from tab order) -->
<button disabled aria-hidden="true">Close</button>aria-live
aria-live는 영역을 라이브 영역으로 바꾸며, 변경 사항이 자동으로 안내됩니다:
<!-- polite: announce when user is idle -->
<div aria-live="polite" id="status"></div>
<!-- assertive: announce immediately, interrupting current speech -->
<div aria-live="assertive" id="errors"></div>
<script>
// Inject text to trigger announcement:
document.getElementById('status').textContent = 'File saved successfully.';
// Screen reader announces this without user moving focus
</script>aria-live 값
aria-live의 세 가지 값:
off— 기본값: 변경 사항을 안내하지 않음polite— 사용자가 잠시 멈추면 안내함; 긴급하지 않은 업데이트에 사용assertive— 즉시 안내하며 현재 음성을 중단함; 오류와 중요한 알림에 사용
aria-atomic
aria-atomic은 전체 영역을 안내할지, 변경된 부분만 안내할지를 제어합니다:
<div aria-live="polite" aria-atomic="true" id="timer">
Time remaining: 05:00
</div>
<!-- aria-atomic="true": announce the whole div each update -->
<!-- Without it: only the changed text node is announced
'Time remaining: 05:00' vs just '05:00' -->
<script>
setInterval(() => {
document.getElementById('timer').textContent = `Time remaining: ${getTime()}`;
}, 1000);
</script>aria-relevant
aria-relevant는 어떤 유형의 변경 사항을 안내할지 지정합니다:
<div
aria-live="polite"
aria-relevant="additions text" <!-- announce added content and text changes -->
id="feed"
>
<!-- New items added here -->
</div>
<!-- Values: additions, removals, text, all
Default: additions text
aria-relevant="removals" needed to announce deleted items -->라이브 영역 모범 사례
라이브 영역 사용 지침:
- 안내 유형마다 지속되는 라이브 영역을 하나씩 사용하십시오(만들었다가 제거하지 마십시오)
- 처음에는 콘텐츠를 비워 두고, 안내를 트리거하려면 텍스트를 삽입하십시오
- 안내는 간결하게 유지하십시오 — 화면 낭독기의 현재 음성이 중단되거나 안내가 뒤처질 수 있습니다
- 로딩 상태에는 polite를 사용하십시오
- 양식 오류에는 assertive 또는 role="alert"를 사용하십시오
토스트 알림 패턴
라이브 영역으로 토스트 알림을 안내하는 방법:
<div
role="status"
aria-live="polite"
aria-atomic="true"
id="toast-container"
class="sr-only"
></div>
<script>
function showToast(message) {
const container = document.getElementById('toast-container');
container.textContent = '';
// Force rerender for re-announcement:
requestAnimationFrame(() => {
container.textContent = message;
});
}
</script>aria-busy
aria-busy="true"는 콘텐츠가 업데이트되고 있음을 나타냅니다:
<div id="feed" aria-live="polite" aria-busy="false">
<!-- content -->
</div>
<script>
const feed = document.getElementById('feed');
feed.setAttribute('aria-busy', 'true');
await loadContent();
feed.innerHTML = newContent;
feed.setAttribute('aria-busy', 'false');
// Only now does the live region announce the update
</script>빠른 확인
aria-live="assertive"와 aria-live="polite"는 각각 언제 사용해야 할까요?
복습: aria-hidden과 aria-live
숨김 및 라이브 영역의 핵심:
aria-hidden="true"— 접근성 트리에서 제거합니다(포커스를 받을 수 있는 요소에는 사용하지 마십시오!)aria-live="polite"— 사용자가 유휴 상태가 되면 변경 사항을 안내합니다aria-live="assertive"— 즉시 안내합니다(오류에 사용)aria-atomic="true"— 변경 시 전체 영역을 안내합니다aria-busy— 로딩 중 안내를 억제합니다
자주 묻는 질문
“aria-hidden 및 aria-live” 강의는 무료인가요?
네 — “aria-hidden 및 aria-live” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 HTML Academy 강의 전체를 잠금 해제할 수 있습니다. HTML Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
“aria-hidden 및 aria-live”에서 뭘 배우나요?
장식용 요소를 숨기고 동적 콘텐츠를 스크린 리더에 알리기 브라우저에서 직접 실행하는 실습 코드로 HTML Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
HTML Academy을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 HTML Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“aria-hidden 및 aria-live” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 HTML Academy 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 HTML Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- ARIA와 기본 HTML 중 무엇을 사용할까
- role button alert dialog 및 landmark
- aria-label aria-labelledby 및 aria-describedby
- aria-hidden 및 aria-live