惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
Lohrmann on Cybersecurity
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
TaoSecurity Blog
TaoSecurity Blog
博客园_首页
Vercel News
Vercel News
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Last Week in AI
Last Week in AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
The Exploit Database - CXSecurity.com
量子位
Project Zero
Project Zero
A
Arctic Wolf
小众软件
小众软件
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
有赞技术团队
有赞技术团队
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Troy Hunt's Blog
P
Privacy & Cybersecurity Law Blog
Security Latest
Security Latest
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
K
Kaspersky official blog
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Webroot Blog
Webroot Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
人人都是产品经理
人人都是产品经理
AI
AI
Cisco Talos Blog
Cisco Talos Blog
MyScale Blog
MyScale Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
S
Schneier on Security
P
Palo Alto Networks Blog

TetraLogical Blog

Designing for people with reading disabilities - TetraLogical Designing for people who are D/deaf - TetraLogical Designing accessible documents - TetraLogical Introduction to creating accessible documents - TetraLogical Inclusive user research: vulnerable people - TetraLogical Designing for people who are blind - TetraLogical Designing for people with low vision - TetraLogical Meet the team: Niamh Madden - TetraLogical Designing for people with anxiety - TetraLogical Designing for people with disabilities - TetraLogical Accessible building blocks for the web videos - TetraLogical Common accessibility misconceptions - TetraLogical Common misconceptions about testing accessibility - TetraLogical Common misconceptions about implementing accessibility - TetraLogical Common misconceptions about WCAG - TetraLogical Common misconceptions about disability - TetraLogical Meet the team: Grace Snow - TetraLogical Sustainable accessibility in complex organisations: strategic foundations - TetraLogical Sustainable accessibility in complex organisations: organisational realities - TetraLogical Sustainable accessibility in complex organisations: external factors - TetraLogical Common misconceptions about screen readers - TetraLogical Guide to the Inclusive Design Principles - TetraLogical Meet the team: Ian Lloyd - TetraLogical Annotating designs using common language - TetraLogical Meet the team: Catriona Morrison - TetraLogical Championing inclusive language - TetraLogical Press release: TetraLogical launches accessible self-led training courses to help digital teams build confidence in accessibility - TetraLogical Why inclusive products are green products - TetraLogical Accessible Recruitment - TetraLogical Accessibility and the agentic web - TetraLogical Meet the team: Craig Abbott - TetraLogical Foundations: types of assistive technology and adaptive strategies - TetraLogical European Accessibility Act (EAA) FAQ - TetraLogical Screen reader HTML support tables - TetraLogical Interview with Lola Odelola - TetraLogical Understanding EN 17161 Design for All - TetraLogical Inclusive user research: building rapport - TetraLogical Can generative AI write contextual text descriptions? - TetraLogical Understanding the European Accessibility Act (EAA) - TetraLogical Meet Josh: a sportsman who has spinal muscular atrophy - TetraLogical Meet Jonathan: a photographer who has ADHD - TetraLogical Foundations: grouping forms with `<fieldset>` and `<legend>` - TetraLogical XR Accessibility: for people with moving disabilities - TetraLogical Meet Andre: a music producer and blind screen reader user - TetraLogical Foundations: types of disability - TetraLogical Meet Lauren: a film editor who has ADHD - TetraLogical Meet Steve: a photographer who is deaf and low vision - TetraLogical Foundations: form validation and error messages - TetraLogical Meet Hasmukh: a blind cricketer and screen reader user - TetraLogical XR Accessibility: for people with hearing disabilities - TetraLogical XR Accessibility: for people with thinking disabilities - TetraLogical XR Accessibility: for people with seeing disabilities - TetraLogical Introduction to XR Accessibility - TetraLogical Foundations: labelling text fields with input and label - TetraLogical Design patterns and WCAG - TetraLogical Does WCAG 2.2 apply to native apps - TetraLogical Why are my live regions not working? - TetraLogical Building a culture of accessibility - TetraLogical When to use tabindex= Accessibility foundations - TetraLogical Meet the team: Demelza Feltham - TetraLogical Can generative AI help write accessible code? - TetraLogical Meet the team: Steve Faulkner - TetraLogical Meet the team: Gez Lemon - TetraLogical Keyboard accessibility myths and WCAG - TetraLogical Amendment to the Public Sector Accessibility Regulations - TetraLogical What Considerations for TV user interface accessibility - TetraLogical Meet the team: Alistair Duggin - TetraLogical Sticky content: focus in view - TetraLogical The only accessibility specialist in the room - TetraLogical Meet the team: Ian Pouncey - TetraLogical Meet the team: Dean Holden - TetraLogical Meeting WCAG Level AAA - TetraLogical Foundations: accessible names and descriptions - TetraLogical Inclusive XR: accessible augmented reality experiences - TetraLogical Foundations: pointer gestures - TetraLogical Meet the team: Graeme Coleman - TetraLogical Adding sign language to videos - TetraLogical Foundations: introduction to WAI-ARIA - TetraLogical Meet the team: Joe Lamyman - TetraLogical Inclusive XR: accessible 3D experiences - TetraLogical Foundations: visible focus styles - TetraLogical Foundations: target sizes - TetraLogical Meet the team: Henny Swan - TetraLogical Meet the team: Ela Gorla - TetraLogical Foundations: native versus custom components - TetraLogical Foundations: HTML semantics - TetraLogical Accessibility and supporting Internet Explorer - TetraLogical Meet the team: Felicity Miners-Jones - TetraLogical Accessibility and QR codes - TetraLogical Inclusive user research: recruiting participants - TetraLogical Research insight: accessibility of images - TetraLogical Meet the team: Léonie Watson - TetraLogical Android accessibility: roles and TalkBack - TetraLogical Accessible design systems - TetraLogical Meet the team: Patrick H. Lauke - TetraLogical Inclusive user research: analysing findings - TetraLogical How to write user stories for accessibility - TetraLogical Triaging WCAG 2.1 Level AAA - TetraLogical
Foundations: Keyboard accessibility - TetraLogical
2025-05-09 · via TetraLogical Blog

Posted on by Demelza Feltham in Design and development

Tags: Assistive Technology, Code, Foundations, WCAG

By prioritising semantic HTML and offering keyboard-friendly alternatives for complex interactions, you help create a more inclusive experience for people who use a keyboard.

Keyboard accessibility ensures that people who navigate websites or apps using a keyboard, whether due to disability, injury, or personal preference, have an experience that is just as functional and efficient as those using a mouse, touch, or other input methods. While the interactions may differ, the goal is to provide equal usability and access to content. Prioritising semantic HTML and offering keyboard-friendly alternatives for complex interactions enhances the experience for all users.

A black and white photo of Bev, a white woman with blond hair in her 50s scooped back in a hairband. She is standing looking into the camera, her head is cocked to the side with a smile while her hands are clasped together in front of her as she holds her brushes in her prosthetic hand and arm.
Bev, an artist with a prosthetic arm, "Accessibility means being able to do things on my own terms, and in my own time".

Who benefits from keyboard accessibility?

Keyboard accessibility is essential for many people with different types of disability that may be permanent, temporary, or situational, or for people who prefer keyboard navigation:

By ensuring robust keyboard support, you create a more inclusive and user-friendly experience for everyone.

A black and white photo of Andre playing an electronic keyboard sitting face on looking down at his hands as he plays. Andre is a younger black man and wears a striped shirt and Ray-Ban Meta Smart Glasses.
Andre, a blind composer and music producer, "I use audio software to control the output from my keyboard during gigs; without accessibility there would be no music".

Where possible, use HTML

There may be situations where delivering an identical experience isn’t possible, so an equivalent experience must always be provided. For example, when exploring an interactive map, people with a mouse might click, drag, or scroll to move around. While these exact interactions may not translate directly to a keyboard, alternative navigation options, such as arrow-key navigation or keyboard-accessible buttons, can provide an equivalent experience.

When building accessible interfaces, start with semantic HTML. In line with the first rule of ARIA, HTML has already done most of the heavy lifting. While ARIA is a powerful tool for remediation, it should be a last resort. Many accessibility issues can be avoided simply by using the correct native elements.

One of the biggest advantages of semantic HTML is that it requires no extra effort for keyboard support. Native interactive elements, such as buttons (<button>) and links with a valid href (<a href="#">), come with built-in keyboard functionality, ensuring a more accessible experience without additional coding.

For example, compare these two buttons:

A native HTML button:

<button>I am a button</button>

  • Uses the <button> element, which is inherently interactive with a keyboard
  • Automatically supports keyboard interactions, for example pressing Enter or Space to activate
  • Is focusable by default (no need for tabindex)
  • Works with screen readers and assistive technology

A custom button:

<div role="button" tabindex="0">I am also a button</div>

  • Requires role="button" so assistive tech recognises it as a button
  • Needs tabindex="0" to be focusable
  • JavaScript must be added to handle keyboard activation (Enter or Space), as <div> does not natively support it

If you can use native HTML, do it. It saves you and your team time, reduces the risk of accessibility failures, and ensures built-in support for keyboard navigation. However, there are instances where native HTML alone may not be enough.

When HTML alone isn't enough

Sometimes, native elements don’t fit the design or functional requirements, and a custom solution is needed. Examples include:

  • Custom dropdowns, when <select> is too limited
  • Modals or dialogs, beyond what <dialog> provides
  • Complex interactive widgets, for example sortable lists, carousels, rich text editors

When creating custom components, you must follow the third rule of ARIA to ensure they remain accessible to keyboard users. This means handling focus properly, supporting keyboard interactions, and maintaining expected behaviours.

Common keyboard accessibility failures

Most common issues associated with the keyboard accessibility of custom controls can be avoided. Two instances that are seen regularly within accessibility assessments result in a failures against:

Clickable controls without tabindex

A common issue is interactive elements that work with a mouse but aren’t accessible by keyboard. This often happens when <div> or <span> elements are used instead of native HTML interactive elements.

This is problematic because by default <div> and <span> elements are not focusable. Similarly, people cannot tab to them, making them completely inaccessible via keyboard. However, these issues can be avoided by following a few steps.

If you must use a <div> or <span> for styling reasons, make it keyboard accessible by:

  • Adding a tabindex="0" to bring it into the focus order, for example <div role="button" tabindex="0">Click me</div>
  • Using JavaScript to add keyboard support and event handlers, for example <div role="button" tabindex="0" onclick="doSomething()" onkeypress="handleKeyPress(event)">Click me</div>

However, using a real <button> is always the better solution.

Non-interactive elements receiving focus

Some developers try to improve accessibility by adding tabindex to non-interactive elements, thinking it will help screen reader users. However, this actually causes more issues than it solves. The motivation behind doing this is often an attempt to create a richer experience for screen reader users, coupled with a misunderstanding of the difference between keyboard and screen reader navigation. Interactive controls receive focus, not static text. So, when static text receives focus by virtue of tabindex values, it creates confusion for people who may believe they can interact with an element that is actually static. It disrupts expected navigation as keyboard users don’t expect to focus on static text.

A common issue arises when tabindex is applied to headings, causing focus order problems. Since non-interactive elements receive focus, they create unnecessary tab stops, disrupting the keyboard navigation experience.

For screen reader users, headings can already be navigated efficiently using built-in shortcuts. For example, when the screen reader NVDA is in browse mode, pressing H moves to the next heading (with its level announced), while Shift + H moves to the previous one. Because these elements are inherently accessible, forcing focus on them with tabindex is redundant.

Avoid using tabindex on non-interactive elements. Instead, structure content with proper headings, landmarks, and semantic elements to enhance navigation. Reserve tabindex only for custom interactive controls when necessary.

Summary

  • Use native HTML whenever possible
  • Ensure custom controls are keyboard focusable by adding tabindex="0"
  • Ensure custom controls are interactive by adding JavaScript
  • Avoid adding tabindex to non-interactive controls

Further reading

Next steps

Read more accessibility foundations posts or sign up for Accessibility Unlocked, our free six-day newsletter series designed to help you kick-start accessibility.