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

推荐订阅源

Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
V
V2EX
量子位
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 【当耐特】
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
小众软件
小众软件
IT之家
IT之家
博客园_首页
博客园 - 聂微东
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗

Hacker News

GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Bonsai 1-bit WebGPU - a Hugging Face Space by webml-community Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line
Don't put aria-label on generic elements like divs - Manu...
Manuel Matuzović · 2026-05-22 · via Hacker News

posted on

This post is part of a series called #WebAccessibilityFails, where I collect common issues I find in accessibility audits so that you can avoid them in the future.

The title already tells most of the story, but here's why you must avoid labeling generic elements like divs or spans using aria-label or aria-labelledby.

<div aria-label="News">
    …
</div>
Don't do this

Looking at the ARIA spec, you'll find section "5.2.8.6 Roles which cannot be named (Name prohibited)". It lists all roles that cannot be named. It includes “generic”, which is the default role of divs and spans.

So, in theory, it's not allowed, but there is also a practical reason to avoid it. Browsers treat labeled generic elements very differently. Below you'll find the results for the following three elements I tested. The results were the same for every element. I've used the arrow keys on desktop and swipe on mobile to navigate.

<div aria-label="News">Content</div>

<p>
  Some inline <span aria-label="News">content</span>
</p>

<ge-neric aria-label="News">
    Content
</ge-neric>

VoiceOver in Safari on macOS announces “News, group“, Talkback in Chrome on Android “News“, and Narrator on Windows 11 with Chrome "News, group, content". All the other tested screen readers ignore the author-defined label completely and announce the text content.

Results from testing labeled generic containers
Screen Reader Browser Announcement
VoiceOver macOS Safari 26.3.1 News, group
VoiceOver iOS Safari 26.3 Content
Talkback Android Chrome 148 News
Talkback Android Firefox 150 Content
Jaws 2026 Windows 11 Chrome 148 Content
NVDA 2026.1.1 Windows 11 Chrome 148 Content
NVDA 2026.1.1 Windows 11 Firefox 150 Content
Narrator, Windows 11 Chrome 148 News, group, content

Update: Verena made me aware that results may differ if the element is empty. So, I tested that as well. I tested both an empty div with 0 width and height, and one that takes up space. There was no announcement in VoiceOver on iOS, JAWS and Narrator in Chrome, or Talkback in Firefox.

<div aria-label="News" style="width:100px; height:100px"></div>
<div aria-label="News"></div>
Results from testing empty labeled generic elements
Screen Reader Browser Announcement
VoiceOver macOS Safari 26.3.1 News, empty group
VoiceOver iOS Safari 26.3 None
Talkback Android Chrome 148 News
Talkback Android Firefox 150 None
Jaws 2026 Windows 11 Chrome 148 None
NVDA 2026.1.1 Windows 11 Chrome 148 News
NVDA 2026.1.1 Windows 11 Firefox 150 News
Narrator, Windows 11 Chrome 148 None

Exceptions

Of course, there are exceptions because otherwise it would be too easy. Honestly, I don't know all of them, but from the top of my head, I can think of two.

sections

The section element has a generic role by default. If you put aria-label or aria-labelledby on the element, its implicit role changes from generic to region, turning it into a landmark. It's fine to label sections if it helps your users.

<section aria-label="News">
    …
</section>

popovers

If you put the popover attribute on a div, its implicit role changes to group. So, if you label it –I'm not saying that you should – you're technically labeling a group and not a generic element, which is fine.

<div popover aria-label="I'm not sure how useful a label here is">
</div>

Updates

Update 25.05.26: Added more tests.