Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Based on an analysis of the provided HTML source code, there are several notable accessibility (a11y) and semantic pitfalls.
- Here is a breakdown of the issues found and how to fix them to align with Web Content Accessibility Guidelines (WCAG):
- 1. Invalid ARIA Attribute on <main>
- The document uses an invalid attribute aria-role. Screen readers will not recognize this.
- Current: <main aria-role=main>
- The Pitfall: There is no such attribute as aria-role in the ARIA specification. The correct attribute is simply role. However, the <main> element inherently possesses the main landmark role, so adding it is entirely redundant.
- Fix: Simply use <main>.
- 2. Skipped Heading Levels
- The page skips directly from <h1> to <h4>.
- Current: <h1>Zellij</h1> ... <h4>Try Zellij Without Installing</h4>
- The Pitfall: Screen reader users frequently navigate pages using heading structures (e.g., pressing "H" to jump to the next section). Skipping heading levels (missing <h2> and <h3>) breaks the document outline and confuses users who might think they skipped a major section of the site.
- Fix: Change the <h4> to an <h2>. You can style the <h2> with CSS to make it look visually smaller if that is the design goal.
- 3. Using Buttons for Navigation (Links)
- JavaScript-powered buttons are being used for file downloads.
- Current: <button type=button ... onclick="location.href='...'">linux download</button>
- The Pitfall: Semantically, <button> elements are for actions on the current page (like submitting a form or opening a modal). Links (<a>) are meant for navigation and retrieving resources (like downloading a file). Because they are buttons, users cannot use standard browser features like "Save Link As..." or "Copy Link Address." Furthermore, screen readers will announce them as "buttons", setting the wrong interaction expectation.
- Fix: Replace the buttons with anchor tags:
- <a href="https://github.com/..." class="download-hover button-style">linux download</a>
- 4. Inaccessible Mobile/Hamburger Menu Trigger
- The hamburger menu icon is wrapped in a generic <span>.
- Current: <span class=menu-trigger><svg ...>...</svg></span>
- The Pitfall: If this element triggers a menu via JavaScript, a <span> is inaccessible. It cannot be navigated to using the Tab key, nor can it be activated using the Enter or Space keys. Additionally, it lacks an accessible name, meaning a screen reader user tabbing to it (if a tabindex were forced) wouldn't know what it does.
- Fix: Use a native <button> and give it an aria-label:
- <button class="menu-trigger" aria-label="Open menu"><svg aria-hidden="true" ...>...</svg></button>
- 5. Reliance on the title Attribute for SVG Links
- The social links rely on the title attribute for accessibility.
- Current: <a href="..." title="Github"><svg>...</svg></a>
- The Pitfall: The title attribute is notoriously inconsistent across different screen readers and browsers. Furthermore, raw inline SVGs can sometimes be read out in confusing ways by screen readers if they are not explicitly hidden from the accessibility tree.
- Fix: Apply an aria-label to the link itself, and hide the SVG visually:
- <a href="..." aria-label="Github on GitHub" rel="me target=_blank" rel="noopener"><svg aria-hidden="true" ...>...</svg></a>
- 6. HTML Syntax Errors
- There is an unclosed <strong> tag.
- Current: <a href=...><strong>Explore Zellij's powerful features →<strong></a>
- The Pitfall: The second <strong> is missing the forward slash </strong>. Invalid nesting or broken tags can occasionally break the accessibility tree in browsers, causing screen readers to misinterpret the DOM.
- Fix: <strong>Explore Zellij's powerful features →</strong>
- 7. Destroying Table Semantics with CSS
- Applying flexbox to a table row.
- Current: <tr style=display:flexbox> (Note: flexbox is also invalid CSS; it should be flex)
- The Pitfall: Even if it were correctly written as display: flex, changing the CSS display property of table elements (<table>, <tr>, <td>) strips them of their semantic table roles in many screen readers. Screen readers will no longer announce row/column associations. If this is meant to be a data table, don't use flexbox on the rows. If it's just for layout, CSS Grid/Flexbox should be used on <div> tags instead of using <table> elements.
Advertisement
Add Comment
Please, Sign In to add comment