이제는 실전이다
지성봉 (멀더끙)
콘텐츠연합플랫폼(주) 퍼블리셔
‘예제로 살펴보는 WAI-ARIA’ 집필진
HTML was primarily designed as a language for semantically describing scientific documents.
Elements, attributes, and attribute values in HTML are defined to have certain meanings (semantics).
Semantic information carried by HTML elements and attributes is integral to making content on the web accessible
ARIA is a set of attributes that you can add to HTML elements.
<input type="text" role="combobox">
<input type="text" role="conbobox" aria-haspopup="true">
<input type="text"
role="conbobox" aria-haspopup="true" aria-expanded="false">
ARIA role, state, property를 추가하는 대신, native HTML element/attribute 를 사용
<!-- If not possible to use the correct element, use this -->
<span role="button">버튼</span>
<!-- If possible to use the correct element, use this -->
<button type="button">버튼</button>
<!-- If not possible to use the correct element/attribute, use this -->
<input type="text" name="usrId" id="usrId" aria-label="아이디">
<!-- If possible to use the correct element/attribute, use this -->
<label for="usrId" class="hidden-accessible">아이디</label>
<input type="text" name="usrId" id="usrId">
정말로 그래야 하는 것이 아닌 이상, native semantic을 변경하지 말아야 함.
<!-- Do not do this -->
<h1 role=button>heading button</h1>
<!-- Do this -->
<h1><button type="button">heading button</button></h1>
<!-- If not possible to use the button element -->
<h1><span role=button>heading button</span></h1>
click, tap, drag, drop, slide, scroll 등의 user interaction은 키보드로도 동등한 동작이 가능해야 함.
<span role="button" aria-pressed="false">좋아요</span>
/*
* required keyboard interaction
* - button must be focusable
* - when on focus the button, presssing Enter or Space key
* activates (or deactivates) the button
* - when the button activated, sets 'aria-pressed' to 'true',
* otherwise 'false'.
*/
키보드 접근이 가능한 요소가 인식될 수 없다면 오류
<!-- Do not do this -->
<button type="button" role="presentation">좋아요</button>
<button type="button" aira-hidden="true">좋아요</button>
대다수 UI의 키보드 인터랙션 요구사항이 W3C 문서에 기술
WAI-ARIA Authoring Practices 1.1어디까지나 기본은 semantic markup
WAI-ARIA는 기본으로 부족한 것을 보완하기 위한 수단