<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>HTML | 锤子前端</title><description>Now vibe coding, so learning hammer FE ?</description><link>https://channel.meo-ai.com</link><item><title>《别在 div 和 span 上乱加 aria-label》</title><link>https://channel.meo-ai.com/posts/649</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/649</guid><pubDate>Sat, 30 May 2026 00:06:23 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《别在 div 和 span 上乱加 aria-label》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23%E5%89%8D%E7%AB%AF&quot; title=&quot;#前端&quot;&gt;#前端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Web%E6%97%A0%E9%9A%9C%E7%A2%8D&quot; title=&quot;#Web无障碍&quot;&gt;#Web无障碍&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23ARIA&quot; title=&quot;#ARIA&quot;&gt;#ARIA&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%B1%8F%E5%B9%95%E9%98%85%E8%AF%BB%E5%99%A8&quot; title=&quot;#屏幕阅读器&quot;&gt;#屏幕阅读器&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23HTML%E8%AF%AD%E4%B9%89%E5%8C%96&quot; title=&quot;#HTML语义化&quot;&gt;#HTML语义化&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;本文通过实测数据揭示了在 div、span 等 generic 角色元素上使用 aria-label 的严重兼容性问题。ARIA 规范明确禁止为 generic 角色命名，而各屏幕阅读器的表现更是天差地别——有的只读标签、有的只读内容、有的两者都读、有的干脆忽略。这种不一致会让依赖辅助技术的用户获得错误信息，属于典型的&quot;好心办坏事&quot;。作者指出 section 和 popover 是例外，前者加标签会自动升级为 region 地标，后者角色会变为 group。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;1. ARIA 规范 &lt;a href=&quot;http://5.2.8.6/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;5.2.8.6&quot;&gt;5.2.8.6&lt;/a&gt; 明确把 generic 角色列入&quot;禁止命名&quot;清单，div 和 span 默认就是这个角色&lt;br /&gt;2. 实测 8 组屏幕阅读器+浏览器组合，对带 aria-label 的 div  announcement 结果五花八门：VoiceOver 读&quot;News, group&quot;、TalkBack 只读&quot;News&quot;、JAWS/NVDA 完全忽略标签只读内容&lt;br /&gt;3. 空 div 的测试结果更混乱，有的读&quot;News, empty group&quot;、有的完全静默，无法预测用户会听到什么&lt;br /&gt;4. 这种不可预测性对屏幕阅读器用户是灾难性的——你以为在帮忙标注，实际上可能覆盖了真正有用的内容&lt;br /&gt;5. 例外情况：section 元素加 aria-label 会自动从 generic 升级为 region 地标，这是规范允许的；带 popover 属性的 div 角色会变为 group，加标签也合法&lt;br /&gt;6. 正确做法：需要可访问名称时，优先使用语义化标签（如 button、nav）或显式设置 role，而不是在裸 div 上硬塞 aria-label&lt;br /&gt;&lt;br /&gt;URL：&lt;a href=&quot;https://www.matuzo.at/blog/2026/aria-label-generic-elements&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://www.matuzo.at/blog/2026/aria-label-generic-elements&quot;&gt;https://www.matuzo.at/blog/2026/aria-label-generic-elements&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://matuzo.at/blog/2026/aria-label-generic-elements&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;I&apos;m a frontend developer in Graz, specialized in HTML, accessibility, and CSS layout and architecture.&quot;&gt;
  &lt;i class=&quot;link_preview_right_image&quot; style=&quot;background-image:url(&apos;https://cdn4.telesco.pe/file/Po93E-loMVAUoNifQaBBchRA8chpsgYG7rol0eYL3iU7tDcaDB39YRnFSr99KmAtmtkLG7V9axFiNKLFe_dcaJixqVI8ztxRfKHUOKp_lEKS6LffJHhh_vFn3mI9F5YzImLE0Nk32zI0WU7c835nh5-Bw2FGOA6ORWVkidzeRFAY-XG4_z-0U_3vagT5pZaauJyp6JL_ABr63pMv1tbn9ncAQngHOfcfvJ0U_nOoJs8viE3N8is2MqfLc4hfiKgG9afjmStwe4IAEn5X4UE5mWvvv52kIDXZpYLXjj9NZ48yjb-axF4OZaNT8m4B7RRs-6qIuthSHYi0QCKW-NwL5Q.jpg&apos;)&quot;&gt;&lt;/i&gt;
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;Manuel Matuzovic&lt;/div&gt;
  
  &lt;div class=&quot;link_preview_title&quot;&gt;Don&apos;t put aria-label on generic elements like divs&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;I&apos;m a frontend developer in Graz, specialized in &lt;mark class=&quot;highlight&quot;&gt;HTML&lt;/mark&gt;, accessibility, and CSS layout and architecture.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>《node-html-to-text：HTML转纯文本转换器》</title><link>https://channel.meo-ai.com/posts/627</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/627</guid><pubDate>Fri, 08 May 2026 02:59:05 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《node-&lt;/span&gt;&lt;mark class=&quot;highlight&quot;&gt;&lt;span class=&quot;post-title-source&quot;&gt;html&lt;/span&gt;&lt;/mark&gt;&lt;span class=&quot;post-title-source&quot;&gt;-to-text：HTML转纯文本转换器》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23NodeJS&quot; title=&quot;#NodeJS&quot;&gt;#NodeJS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%B7%A5%E5%85%B7%E5%BA%93&quot; title=&quot;#工具库&quot;&gt;#工具库&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23HTML%E8%A7%A3%E6%9E%90&quot; title=&quot;#HTML解析&quot;&gt;#HTML解析&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%96%87%E6%9C%AC%E8%BD%AC%E6%8D%A2&quot; title=&quot;#文本转换&quot;&gt;#文本转换&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E6%95%B0%E6%8D%AE%E6%8F%90%E5%8F%96&quot; title=&quot;#数据提取&quot;&gt;#数据提取&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E5%86%85%E5%AE%B9%E5%A4%84%E7%90%86&quot; title=&quot;#内容处理&quot;&gt;#内容处理&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;node-&lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt;-to-text 是一款成熟的 Node.js 库，用于将 &lt;mark class=&quot;highlight&quot;&gt;HTML&lt;/mark&gt; 文档解析并转换为格式优美的纯文本。它通过类 CSS 的 selectors 机制实现高度灵活的格式化控制，支持表格、链接、列表等复杂结构，并提供 &lt;code&gt;compile&lt;/code&gt; 预编译模式以优化批量处理性能。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;- **核心能力**：支持行内/块级标签、表格（含跨行跨列）、链接、自动换行、Unicode 等，能把复杂 &lt;mark class=&quot;highlight&quot;&gt;HTML&lt;/mark&gt; 干净地转成可读文本&lt;br /&gt;- **两种使用模式**：`convert()&lt;code&gt; 适合单次转换；`compile()&lt;/code&gt; 预编译配置后批量处理，性能更优，推荐处理大量文档时使用&lt;br /&gt;- **Selectors 驱动配置**：采用类似 CSS 的 selectors 数组来匹配元素并指定格式化方式，支持标签、类名、ID、属性等组合选择，特异性高的规则优先生效&lt;br /&gt;- **丰富的自定义扩展**：可通过 &lt;code&gt;formatters&lt;/code&gt; 注册自定义格式化函数，还能传入 &lt;code&gt;metadata&lt;/code&gt; 让 formatter 访问额外上下文信息，满足特殊业务需求&lt;br /&gt;- **版本演进清晰**：v8 引入 selectors 体系，v9 支持 ESM/CJS 双模式并移除大量废弃选项，v10 要求 Node.js 20.19.0+，API 趋于稳定现代&lt;br /&gt;&lt;br /&gt;文章URL：&lt;a href=&quot;https://github.com/html-to-text/node-html-to-text&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://github.com/html-to-text/node-html-to-text&quot;&gt;https://github.com/html-to-text/node-html-to-text&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://github.com/html-to-text/node-html-to-text&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;Advanced html to text converter. Contribute to html-to-text/node-html-to-text development by creating an account on GitHub.&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;GitHub&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;GitHub - html-to-text/node-html-to-text: Advanced html to text converter&quot; src=&quot;/static/https://cdn4.telesco.pe/file/tGWHIZyJJC5Ye9s5VDqSPnTgKlQyAnKqtCcRPpwB_0V1IWL1E87QBCtIuEKcjuxdcet0AbWOasEbuOEUgE3tvRu4yUOULMhA0C-2JMiwZDBArApGKL7XjQqSWIXSY4B6DCZ-jLNNwbbV06dt5ah5wwt86McAWIjGBoaecR478xAsgPPUNeTL5kWR9Wytus6DMQQObnf9CHh7SzpXHUt8FayyTGe6OmmBANfk4GZ_e9JOiNX5HnPO_M3uktlVYC-dK_GyNaGcrofbInNPt7MowUnOB-tE1k9UoUegUtz6vKsdA_yZ2FLVbaWht43iJ6vMpM8tku3che7yAcoZBITBCg.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;GitHub - &lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt;-to-text/node-&lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt;-to-text: Advanced &lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt; to text converter&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;Advanced &lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt; to text converter. Contribute to &lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt;-to-text/node-&lt;mark class=&quot;highlight&quot;&gt;html&lt;/mark&gt;-to-text development by creating an account on GitHub.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>#文章 #HTML 关于&lt;search&gt;元素，旨在作为搜索界面的专用容器，提供更好的可访问性，并明确搜索相关内容的目的</title><link>https://channel.meo-ai.com/posts/94</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/94</guid><pubDate>Mon, 02 Dec 2024 15:58:55 GMT</pubDate><content:encoded>&lt;a href=&quot;/search/result?q=%23%E6%96%87%E7%AB%A0&quot; title=&quot;#文章&quot;&gt;#文章&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23HTML&quot; title=&quot;#HTML&quot;&gt;#HTML&lt;/a&gt; 关于&amp;lt;search&amp;gt;元素，旨在作为搜索界面的专用容器，提供更好的可访问性，并明确搜索相关内容的目的。&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.trevorlasn.com/blog/html-search-element&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://www.trevorlasn.com/blog/html-search-element&quot;&gt;https://www.trevorlasn.com/blog/html-search-element&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://trevorlasn.com/blog/html-search-element&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;The search HTML element is a container that represents the parts of the web page with search functionality&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;The HTML Native Search Element&lt;/div&gt;
  
  
  &lt;div class=&quot;link_preview_description&quot;&gt;The search &lt;mark class=&quot;highlight&quot;&gt;HTML&lt;/mark&gt; element is a container that represents the parts of the web page with search functionality&lt;/div&gt;
&lt;/a&gt;</content:encoded></item></channel></rss>