[h6 aria-level ="7"]是创建[h7]元素的可靠方法吗? [英] Is [h6 aria-level="7"] a reliable way to create a [h7] element?

查看:76
本文介绍了[h6 aria-level ="7"]是创建[h7]元素的可靠方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,HTML标题只能在变为无效之前升至< h6> .据我所知,以下是在HTML中创建< h7> 元素的完全有效的方法:

Typically, HTML headings are only able to go up to <h6> before it becomes invalid. As far as I can tell, the following is a completely valid way to create a <h7> element in HTML:

<h6 aria-level="7">This is a heading level 7 element</h6>

我已经在Chrome,Firefox和Internet Explorer的NVDA中对此进行了测试,并且可以正常工作.

I have tested this in NVDA in Chrome, Firefox and Internet Explorer and it works as intended.

我实际上没有访问任何其他屏幕阅读器的权限.可以访问大量屏幕阅读器/浏览器组合的人是否可以确认上述内容是否始终作为< h7> 元素传达给用户?

I don't really have access to any other screen readers though. Can someone with access to lots of screen reader / browser combinations confirm whether the above is consistently conveyed to the user as a <h7> element?

如果您知道屏幕阅读器/浏览器组合无法使用此技术 ,请告诉我.

If you know of a screen reader / browser combination where this technique definitely doesn’t work, please let me know.

推荐答案

尽管< div role ="heading" aria-level ="7"> 似乎是定义的有效方法作为H7元素,屏幕阅读器并不像H1-H6那样普遍认为它.我至少可以确认它不适用于Jaws.对于Jaws,情况更糟,它被视为H2!

Although <div role="heading" aria-level="7"> seem to be a valid way to define a H7 element, screen readers don't universally consider it like H1-H6. I can at least confirm that it doesn't work with Jaws. With Jaws it is even worse, it is taken as H2!

使用Jaws在Firefox,Chrome和IE11上进行测试.还对级别8、9、10、11和12进行了测试.将 aria-level ="X" X> 6 一起指定总是会将其转换为H2.

Tested with Jaws on firefox, chrome and IE11. Also tested with levels 8, 9, 10, 11 and 12. Specifying aria-level="X" with X>6 invariably turn it into H2.

因此,请勿使用此技巧来制作一种H7元素.它不受普遍支持.

So, don't use this trick to make a kind of H7 element. It isn't universally supported.

您最好再考虑一下页面的结构.您真的需要7个级别的标题吗?经常有人说,一个好的文档不应超过3个级别,对于一个很长或很沉重的技术文档,不应超过4个级别,特别是5个级别.考虑到H1的特殊地位,让我们添加一个级别.因此,六个级别必须足够.

You'd better think again the structure of your page. Do you really need 7 levels of headings? It is often said that a good document shouldn't have more than 3 levels, maybe 4 for a very long or heavy technical document, exceptionally 5. Given the special status of H1, let's add one. So, 6 levels must be more than enough.

您是否跳过了某些级别?跳过标题级别在语义上是错误的,您不应该仅仅因为视觉外观就这样做.

Haven't you skipped some of the levels? Skipping heading levels is semantically incorrect, and you shouldn't do it just because of visual appearance.

实际上, ARIA规范从未明确指出指定一个级别高于6是允许的.aria-level的默认值为2.这解释了Jaws在遇到无效的aria-level值时的合法行为.

In fact, the ARIA specification never explicitly state that specifying a level above 6 is permitted. The default value for aria-level is 2. This explains the legitimate behavior of Jaws while encountering an invalid value for aria-level.

这篇关于[h6 aria-level ="7"]是创建[h7]元素的可靠方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆