aria-label aria-labelledby 및 aria-describedby
요소에 접근 가능한 이름과 설명 제공하기
aria-label aria-labelledby 및 aria-describedby은(는) CoddyKit의 무료 HTML Academy 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 HTML Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. HTML Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
접근 가능한 이름이 중요한 이유
모든 상호작용 요소에는 접근 가능한 이름이 필요합니다. 접근 가능한 이름은 보조 기술이 요소를 식별하는 데 사용하는 텍스트 문자열입니다. 접근 가능한 이름이 없으면 화면 낭독기는 사용자에게 버튼이나 입력란의 기능을 알려 줄 수 없습니다.
aria-label
aria-label은 요소에 직접 텍스트 접근 가능한 이름을 제공합니다:
<button aria-label="Close dialog">×</button>
<!-- The × character has no accessible meaning
aria-label provides the name: 'Close dialog, button' -->
<input type="search" aria-label="Search products">
<!-- No visible label — aria-label provides the accessible name -->aria-labelledby
aria-labelledby는 다른 요소를 접근 가능한 이름으로 참조합니다:
<h2 id="section-title">Billing Information</h2>
<form aria-labelledby="section-title">
<!-- Form's accessible name is 'Billing Information' -->
</form>
<!-- Multiple id references: -->
<button aria-labelledby="action-verb object-name">
Delete
</button>
<span id="object-name" hidden>User Account</span>
<!-- Screen reader: 'Delete User Account, button' -->aria-describedby
aria-describedby는 확장 설명을 제공합니다(이름을 보완하는 설명):
<label for="pwd">Password</label>
<input
type="password"
id="pwd"
aria-describedby="pwd-hint"
>
<p id="pwd-hint">Must be 8+ characters with one uppercase letter and one number.</p>
<!-- Screen reader: 'Password [input]' then reads the description on focus -->레이블과 설명
접근 가능한 이름과 설명의 차이:
- 접근 가능한 이름 — 요소를 식별합니다(aria-label, aria-labelledby 또는 label 요소)
- 설명 — 추가적인 문맥으로 이름을 보완합니다(aria-describedby)
- 화면 낭독기는 이름, 역할, 상태를 안내한 다음 설명을 안내합니다
랜드마크의 aria-label
같은 유형의 랜드마크가 여러 개 있을 때 aria-label을 사용하여 구분하세요:
<nav aria-label="Primary">...</nav>
<nav aria-label="Breadcrumb">...</nav>
<!-- Screen reader landmark list:
'Primary, navigation'
'Breadcrumb, navigation' -->
<!-- When only one nav, aria-label is optional but still helpful -->구역의 aria-labelledby
화면 낭독기에 문맥을 제공할 수 있도록 구역을 해당 제목과 연결하세요:
<section aria-labelledby="about-heading">
<h2 id="about-heading">About Our Team</h2>
<p>We are a team of passionate developers...</p>
</section>
<!-- Screen reader: 'About Our Team, region' when entering section -->aria-label과 표시되는 텍스트
aria-label은 표시되는 텍스트를 덮어쓰므로 주의해야 합니다:
<button aria-label="Delete account permanently">
Delete
</button>
<!-- Screen reader hears: 'Delete account permanently'
Sighted user reads: 'Delete' -->
<!-- Best practice: visible text and aria-label should agree
If possible, include extra context in visible text too:
<button>Delete account permanently</button> -->
<!-- aria-label should start with the visible text when possible
for speech recognition users who use voice commands -->오류에 aria-describedby 사용하기
오류 메시지를 입력란에 연결하세요:
<label for="email">Email</label>
<input
type="email"
id="email"
aria-describedby="email-error"
aria-invalid="true"
>
<span id="email-error" role="alert">
Please enter a valid email address.
</span>
<!-- When input receives focus, screen reader reads:
'Email [field], invalid. Please enter a valid email address.' -->여러 aria-describedby 참조
aria-describedby는 여러 요소를 참조할 수 있습니다:
<input
type="password"
aria-label="New password"
aria-describedby="pwd-hint pwd-strength"
>
<p id="pwd-hint">Must be 8+ characters.</p>
<meter id="pwd-strength" aria-label="Password strength" value="2" max="4">Medium</meter>
<!-- Both elements are announced as the description -->표시되는 레이블과 숨겨진 레이블
표시되는 레이블을 사용할 수 없을 때는 sr-only 클래스를 사용하세요:
<label for="search" class="sr-only">Search</label>
<input type="search" id="search" placeholder="Search...">
/* Visually hidden but in accessibility tree: */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}빠른 확인
aria-label과 aria-labelledby의 차이는 무엇입니까?
복습: ARIA 레이블
접근 가능한 이름 지정의 핵심:
aria-label— 표시되는 레이블이 없는 요소에 사용하는 인라인 텍스트 이름aria-labelledby— id로 기존의 표시되는 텍스트를 참조합니다aria-describedby— 보충 설명(이름 다음에 읽힙니다)- 표시되는 레이블과 기본 HTML label 요소를 우선 사용합니다
- 랜드마크의 aria-label은 같은 유형의 영역이 여러 개일 때 구분해 줍니다
자주 묻는 질문
“aria-label aria-labelledby 및 aria-describedby” 강의는 무료인가요?
네 — “aria-label aria-labelledby 및 aria-describedby” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 HTML Academy 강의 전체를 잠금 해제할 수 있습니다. HTML Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
“aria-label aria-labelledby 및 aria-describedby”에서 뭘 배우나요?
요소에 접근 가능한 이름과 설명 제공하기 브라우저에서 직접 실행하는 실습 코드로 HTML Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
HTML Academy을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 HTML Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“aria-label aria-labelledby 및 aria-describedby” 강의는 얼마나 걸리나요?
대부분의 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