Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Semantic HTML and Page Structure in Angular: Fixing Openbook's Foundation

Part 2 of a series on Angular accessibility. Part 1 introduced Openbook, a fictional demo app that starts out deliberately inaccessible. In Part 1, I read through Openbook's code and listed what I expected to go wrong. This post starts fixing it, beginning with the foundation: the HTML itself. Most of the changes are small, and they make the biggest difference to keyboard and screen reader users,…

In Part 2 of a series on Angular accessibility, this article focuses on fixing the foundation of the Openbook demo app, which starts out with significant accessibility issues. The changes primarily revolve around the HTML structure itself.

Originally, Openbook's page had no landmarks, such as header, nav, and main elements. This made it difficult for screen readers to navigate the page. The solution introduced a header with a logo and a nav section labeled "Main" using the aria-label attribute. The main section was given an id of "main" with a tabindex of "-1" to allow focusing it via code.

Additionally, a skip link was added to allow keyboard users to directly jump to the main content, bypassing the navigation items. The link itself was styled to become visible when focused and is hidden initially.

Clickable div elements were replaced with native anchor tags for navigation. This change made the links focusable, operable with Enter key, and properly announced by screen readers. Aria-current attribute was added to indicate which link is currently active.

Icon buttons were also updated. Previously, they contained only SVGs with no accessible name, which screen readers couldn't describe. Now, the buttons have an aria-label attribute that conveys the purpose of the button, such as "Notifications". The SVGs were made focusable but hidden from screen readers, ensuring only the button text is announced.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Report a problem with this story

Get the day's news by email. Daily, weekly or monthly. Sign up

More in Tech

More from Thursday, 3 December 2026 →