Semantic HTML and a11y Flashcards
Practice Resource: Semantic HTML
https://learn.shayhowe.com/html-css/getting-to-know-html/
Resource: HTML Dog : Tags, Attributes and Elements
http://www.htmldog.com/guides/html/beginner/tags/
Resource: Mark Pilgrim’s Dive into HTML
http://diveinto.html5doctor.com/
Mozilla’s Developer Network (MDN)
https://developer.mozilla.org/en/docs/Web/HTML/Element
What is Semantic HTML?
The practice of choosing an HTML element to wrap content that most clearly aligns with the meaning of your content.
What are some elements that can strengthen the Semantic HTML on your document?
When you’re writing HTML, strive to use elements that communicate the meaning of your document’s structure
To name a few: <p>,, , , , , and others when appropriate.</p>
Resource: Mozilla’s HTML Element Reference
https://developer.mozilla.org/en-US/docs/Web/HTML/Element
What is A11Y or a11y?
It stands for “accessibility” and its a principle that every programmer should be thinking of when building code.
It is the practice of making web pages accessible to both able-bodied and disabled users.
Why is A11y so important? (1/2)
The web has user of every stripe, including many with disabilities. The web should be made with everyone’s usability in mind.
Why is A11y so important (2/2)
Web crawlers index content on the pages you code to make it appear in searches.. The better the semantic html code, the better the SEO results.
Define a mouse user:
usually not visually or dextrously impaired. Uses the mouse or touchpad for most web navigation
Define a keyboard user:
Primarily uses the keyboard or keyboard and mouse combo, like a power user.
Define a screen reader user:
Are visually impaired people who have websites read to them by a screen reader, which is an assistive technology that reads the contents of a web page out loud.
Screen reader users may not be blind but still benefit from audio to help them process the websites they use.
Resource: Valid HTML Language Codes
https://www.w3schools.com/tags/ref_language_codes.asp
How can the lang attribute be used? (1/2)
It can be used in the opening tag .
This will tell the whole page to orate in whatever language defined. THIS SHOULD BE DONE EACH AND EVERY TIME YOU CODE.
ex:
How can the lang attribute be used? (2/2)
It can also be used on a specific element on an html document.
For example, if a paragraph is written in spanish,
You want an orator on the page with spanish dialect and way of speaking, not english
<p> Yo soy Maria. Qual es tu nombre?</p>
What is a “role” attribute?
Roles tell a browser, “This is the kind of job my content is supposed to do.” They make it easier for screen reader users to understand what is on the page and how to use it
Are there lots of types of “roles”?
Yes, there are. Here is a resource:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
Resource: Mozilla ARIA and Roles
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
What does ARIA stand for?
Accessible Rich Internet Applications
What is ARIA used for?
Screen readers use ARIA to help people who use assistive technologies understand and use web sites.
What element is the “banner” role used for?
It is used with the element
It is an HTML5 section role
Example: Content here
What is the proper codeout for a role?
The role should always be surrounded by quotation marks.
Ex: Menu
What element is the “navigation” role used for?
It is used with the element
It is an HTML5 section role
Example: Quicklinks
What element is the “main” role used for?:
It is used with the . element
It is an HTML5 section role
Example: Content here
What element is the “contentinfo” role used for?
It is used with the . element
It is an HTML5 section role
Example: Phone: 555.12.12
What element is the “region” role used for?
It is used with the . element
It is an HTML5 section role
Example: Content here
What’s the point or importance of using roles in my HTML coding?
Its important because roles give implicit instructions in the HTML document .
There is no mistaking/confusing the purpose of an element if there is role attached to it.
This makes code easier to read and render, thus making the best possibility for users who may need to use assistive technology.
Roles can be defined as ARIA landmarks. Why?
Through their roles, these elements serve as ARIA landmarks for visually impaired people.
Think of ARIA landmarks as a list of shortcuts.
Just as you can quickly glance around to find a part of a page you want, a screen reader user can quickly cycle through landmarks to get where they want to go.
But isnt the use of roles redundant since the element defines what its supposed to be anyway.
Yes it is redundant, but is good redundancy.
Also, older browsers don’t know the implicit roles of HTML5 elements like , , , and so we have to help them out by explicitly setting redundant roles using the role attribute.
Can I have more than one “banner” role per HTML document?
NO, you should not.
Since you should not have more than one element per page, it follows reason that you should not have more than one “banner” role per page since
that role is explicitly used for the element.
For the best code always do the following:
– use structured, semantic HTML
– set the lang attribute on the opening HTML tag
– set the role attribute where appropriate, especially for sectioning elements like:
for site-wide headers
for navigation elements
for main elements
for your site’s footer