Accessibility- Semantics Basics
- How to create websites for users with visual disabilities?
- How to use HTML effectively to create a good experience for all users?
- a. Semantics & Assistent Technology
- b. Affordances
- c. Role Name State Value
- d. The Accessibility Tree
- e. Semantics in Native HTML
- f. Naming Labeling and Alternative text
Assistent Technology = all devices, software, and tools, that help any person with a disability complete a task.
- Examples: screen reader, braille display, magnification,voice controll, switch access, sip & puff, eyetracking, but also robotic devices, browser zoom, customed designed game controller and add-on chrome extension.
- For all these technologies, programmatic expressed semantics are needed.
- Affordances: the qualities (
properties) of an object, that defines its use. - Examples: buttons, sliders, sroll-downs, playback controls, price limites
Choose an optionEnter a line of textEnter a specific dateYes/No optionPerform an action
How to access the visual information of the User Interface (UI)?
- Information need to be expressed in such a way that it is accesible programmatically by assistence technology.
- Markup is used in a way that
facilitates accesibility, so a Screen reader can provide info for Elements': - ROLE= _What type? ex. Edit Text
- NAME= What name(label)? ex. your e-mail address
- STATE = What state?
- VALUE= What value?
SOURCES: WebAim
-
Considering the A11y tree when writing your HTML will help in making your sites more accessible.
-
The browser transforms DOM tree (
natively semantic elementsorothered with ARIA) into the Accessibility tree (=all information for screenreader:Name,Role,StateandValue). -
It can be done, for much of the DOM has
implicit semantic meaning. It uses standard HTML native elements that are automatically recognized by browsers on a variety of platforms. -Using the proper semantic elements will make your life much easier when addressing accessibility concerns. -
Example:
-
Main -
Form -
Radio Button: name= "round trip", state= "selected" -
Edit Text: name = "full name" -
Combo box: value= "no preference", name: "Seat type", state= "collapsed" -
Button: name= "search"
<main>
//<div class= "card">
<form>
//<div class= "trip selector">
//<div class= "row">
//<div class= "inline control col-2">
<label for="seatType"> SteatType </label>
<select name="seatType" id= "seatType">
<option value="0">No preference</option>
<option value="1">Aisle seat</option>
<option value="2">Window seat</option>
</select>
//</div>
//<div class= "inline control submit-form col-1">
<button type= "submit" id= "submitBtn">Search</button>
//</div>
//</div>
//</div>
</form>
//</div>
</main>
NOTE: information will be reduced to the most important information only: Name, Role, State and Value.
<label>
<input type="radio" checkedName= "tType" value= "0">
Round Trip
</Label>
- WebAIM Guideline 1.1
- label demonstrates two !label" options with it's labelling.
- label The W3C list of types of elements for a "label" tag.
- Using proper labeling not only helps accessibility but it makes the element easier to target for all users!
- There are 2 ways of labeling form inputs.
- Element could have a:
visual label (name)name="radio button" or a
<label>
<input type="radio">
Check me
</label>
text alternativeimages.
<input type="radio" id="radio-button">
<label for="radio-button">Check me</label>
- Using these labeling allows users to
toggle the input elementby also clicking the label.
Alt text:
- Use an alternative text to the image, if not loaded.
- Describe what the image about for screen reader.
- Logos = assign the company name.
- Search icon = empty alt. (This will skip it from accessibility tree.)
- Any image meant for decoration = empty alt.
- Specify each image's alt attribute in full, e.g.
alt="bees".
- Check this SEMANTIC HTML