5 Ways Your HTML Code Affects A Screen Reader
Tags: html, beginners, webdev, basics
Published: 2019-03-18 03:09:48

---
title: 5 Ways Your HTML Code Affects A Screen Reader
published: true
description: 5 basic ways to help keep screen readers top of mind
tags: #html #beginners #webdev #basics
---

Screen readers are important because they make the Internet an inclusive place. A screen reader is software that reads the contents of a webpage aloud to a user, and are most helpful for those who are visually impaired/blind, have a cognitive disability, or are illiterate.  Screen readers are responsible for identifying data on a webpage, interpreting that data, and then communicating the data to the user. This can be output through the voice of the computer or through a braille terminal (pictured below). 

![braille terminal](https://thepracticaldev.s3.amazonaws.com/i/3ycfp49550zbyvot33uu.png)

To reiterate, screen readers play an incredibly important role to those who utilize them, as they serve as a gateway to the Internet for those who cannot access it on their own.  Completing everyday tasks such as emailing, paying online bills, or booking a plane ticket might not be possible without the aid of a screen reader. 

Because of their importance, it is imperative that Software Engineers remain educated and mindful of screen readers as they build and shape the Internet. I hope that with this post I can help to remind the developer community of the responsibilities we share to make the Internet an inclusive and accessible environment for everyone. Kindly note that I am not covering all the ways HTML code affects a screen reader and this article is intended only as an introduction to the topic. 

## 5 Ways Your HTML Code Affects A Screen Reader:

### Alternate Text for Images 

Screen readers can’t “read” images. Instead they read the alternate text provided through the HTML tag.  This alternate text should give an accurate and clear description of the image’s contents.  If there is no alternate text provided, the screen reader will read “graphic”.  Not very user-friendly is it?  Be sure to include a meaningful description of each image you include in a webpage. 

![alt text for images example](https://thepracticaldev.s3.amazonaws.com/i/goxa3x5r7ypf11tqwcku.png)

### Language

HTML allows you to specify the language your page is written in.  This allows for seamless translation when your page is accessed in another country, or by a user with different language settings.  If your page includes snippets of text from other languages, you’ll need to add another language tag surrounding the foreign snippet. This way, as a screen reader parses through your page it can read and translate the text into the appropriate language. 

![examples of entire doc language and sectional language]
(https://thepracticaldev.s3.amazonaws.com/i/5nzxlq1l0ht9n4olmy1x.png)

 
### Semantic Structure

Screen readers will announce the text included in tags such as title or h1.  Therefore, it is important to be strategic and mindful about what you are identifying as headers.  Be sure that each of your headers throughout the page are valid and justify being read with emphasis. It is important to note that header tags should always be used - never tweak the size of the font or bold in place of a header tag.  A screen reader looks for concrete HTML indicators to announce something as a heading so make sure to provide so. 

![example of main header in html]
(https://thepracticaldev.s3.amazonaws.com/i/j5frcdp1ejqifntcpfk1.png) 

![example of bold and italicized font in html]
(https://thepracticaldev.s3.amazonaws.com/i/j011nrypye8qfefzdgga.png)

The same applies for text within the body of the paragraph. While the strong (strong) and emphasis (em) tag will be picked up by the screen reader, the bold (bold) and italicize (i) tags will not be communicated to the user because they only have visual implications. 


### Links

Links are announced and read aloud for their entirety.  This means that links with long text - more than a phrase or word - will often confuse the user and could result in them skipping the link all together.  Additionally, links that are too short could prove difficult for a user to click on.  Someone with a physical disability might use a screen reader as an aid, but use their mouse on their own. If the link is a single character, they might have trouble aiming the mouse perfectly over the link to click.  Keep this in mind when deciding on the text that serves as a link.

![example of brief and concise links in html](https://thepracticaldev.s3.amazonaws.com/i/zjx9jezcwhhmdpcpk5jg.png)

### Page Structure

When a human views a web page for the first time, they’re able to visually assess the page: general layout, color scheme, context, and route of navigation. A screen reader doesn’t have this luxury. Instead, each section of a page is read step-by-step in order top to bottom. Therefore, it is important that the layout of your page makes sense. Ask yourself - is all the content ordered in a way that would make sense if a user could only read top to bottom?

Now, take into consideration that the user can tell a screen reader to jump around to different parts of the page.  Say I tell my screen reader to jump to the main context section, will the context here make sense? Is it actually the main section of the page? Additionally, are the navigation tabs across the page identified as navigation? When I ask my reader to go there will I understand the various links available to jump around the site?  With these questions in mind, make sure that your page is organized in a way that makes intuitive sense to any user.

![main content example on starbucks.com](https://thepracticaldev.s3.amazonaws.com/i/hwd8z265oulv5wgr47pr.png)

My inspiration for this post came from an article I found on [Fast Company](https://www.fastcompany.com/40555815/what-its-like-to-be-a-blind-software-engineer-at-amazon).  The article tells a remarkable story about Michael Forzano, who has been working as a Software Engineer at Amazon since 2013. Michael was born with Norrie disease has been blind since birth. He relies on screen readers each day - at home and at the office.  His story is incredibly inspiring and impressive.  I encourage you to read and share the story with your colleagues.  

I hope that we can all take a moment to reflect on the integral role Software Engineers play in a world which continues to rely more and more on the Internet each day.  Because we shape a user’s experience on the web, it is critical we maintain these best practices to maintain a low barrier to entry, so that anyone may participate. By keeping screen readers in the front of our minds, we can ensure that everyone can benefit from the Internet.

Resources:
[American Foundation for the Blind](http://www.afb.org/prodBrowseCatResults.aspx?CatID=49)
[WebAIM](https://webaim.org/techniques/screenreader/)
[Fast Company](https://www.fastcompany.com/40555815/what-its-like-to-be-a-blind-software-engineer-at-amazon)