Accessibility & ARIA Basics
Accessibility means making websites usable for everyone, including people using screen readers, keyboard navigation or assistive technologies. This chapter builds responsible web design habits.
Alt Text
Gives meaningful image descriptions for screen readers.
Labels
Connect form fields with clear field names.
Keyboard Access
Allows users to navigate without a mouse.
ARIA
Adds extra information when native HTML is not enough.
After This Chapter, You Will Understand
This chapter teaches the first steps toward inclusive and user-friendly webpage development.
Accessibility
Understand why websites should work for all users.
Alt Text
Write useful image descriptions for screen readers.
Forms
Create form fields with proper labels and instructions.
ARIA
Understand basic ARIA roles and aria-label usage.
What is Web Accessibility?
Accessibility means creating websites that can be used by people with different abilities and devices.
1 Simple Meaning
A website should be usable by people who cannot see clearly, cannot use a mouse, use screen readers, use keyboard navigation, or have slower internet or older devices.
2 Why It Matters
- Improves usability for all users
- Helps screen reader users understand content
- Makes forms easier to fill
- Supports keyboard-only navigation
- Creates more professional and responsible websites
Basic Accessible HTML Habits
Good accessibility starts with clean and meaningful HTML.
| Practice | Why It Helps | Example |
|---|---|---|
| Use proper headings | Creates a clear content structure | Use h1, h2, h3 in order |
| Use semantic tags | Helps assistive tools understand page areas | header, nav, main, footer |
| Write alt text | Explains images to screen reader users | <img alt="Student using laptop"> |
| Use descriptive links | Explains where a link will take the user | View Course Details |
| Use labels in forms | Makes fields clear and clickable | <label for="email">Email</label> |
| Keep enough contrast | Makes text easier to read | Dark text on light background |
3 Good Alt Text
<img src="student.jpg" alt="Student practicing HTML on laptop">
Good alt text describes the meaning of the image, not just the file name.
4 Poor Alt Text
<img src="student.jpg" alt="image">
Words like image, photo or pic do not explain what the image shows.
Labels and Helpful Instructions
Forms should be easy to understand, fill and submit.
5 Label Connection
The for attribute in label should match the id attribute of the input field. This makes the form field easier to use and understand.
<input type="email" id="email" name="email">
6 Helpful Message
Use clear instructions for fields like password, mobile number or file upload.
<input type="tel" id="mobile" aria-describedby="mobileHelp">
<small id="mobileHelp">Enter 10 digit mobile number.</small>
Make Pages Keyboard Friendly
Many users navigate websites using Tab, Enter, Space and arrow keys.
Keyboard Focus Demo
Use the Tab key on your keyboard to move focus between these elements.
7 Focus Visibility
Keyboard users need to see which link, button or input is currently active. Never remove focus outline without giving a better visible focus style.
What is ARIA?
ARIA gives extra information to assistive technologies when normal HTML is not enough.
aria-label
Gives an accessible name when visible text is missing or not enough.
aria-describedby
Connects an input field with a helpful instruction or explanation.
<small id="help">Enter valid email.</small>
role
Defines the purpose of an element when native semantic HTML is not enough.
Create an Accessible Contact Form
Edit the code and click Run Code to see the output.
Mistakes Students Should Avoid
Accessibility mistakes can make websites difficult for many users.
Wrong Habits
- Using images without meaningful alt text
- Creating forms without labels
- Writing vague link text like “click here”
- Removing focus outline completely
- Using ARIA everywhere without understanding
Correct Habits
- Write meaningful alt text for important images
- Use labels for all important form fields
- Write descriptive link text
- Keep clear keyboard focus style
- Use semantic HTML before ARIA
Test Your Understanding
Select the correct answers and check your score.
1. Accessibility means:
2. Which attribute describes an image?
3. Which tag gives a name to a form field?
4. Which attribute can give an accessible name to an icon-only button?
5. What should be used first before ARIA?
Remember These Points
Revise these before moving to Chapter 13.
Accessibility
It means creating websites that can be used comfortably by everyone.
Alt Text
Alt text describes images for screen reader users and when images do not load.
Labels
Labels make form fields clear and easier to use.
Keyboard Focus
Users should be able to navigate links, buttons and fields using the keyboard.
ARIA
ARIA adds extra accessibility information when normal HTML is not enough.
Semantic First
Use semantic HTML first, then use ARIA carefully only when needed.