应该将role =“" contentinfo"设置为始终添加在页脚元素上? [英] Should role="contentinfo" be always added on footer element?

查看:138
本文介绍了应该将role =“" contentinfo"设置为始终添加在页脚元素上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ARIA演示网站上,通常在footer元素上添加role="contentinfo".

On ARIA demonstration websites, role="contentinfo" is usually added on footer element.

但是,现代网页设计中的页脚可以发挥创意,使它们也可以包含补充导航链接,社交网站链接,甚至是新闻简报之类的内容.

However, footers in modern web design can be creative so that they can also contain things like supplementary navigation links, social website links, or even a newsletter form.

以下面的页脚代码为例.是否应在footerp元素上添加role="contentinfo"?

Taking the following codes of footer for example. Should role="contentinfo" be added on the footer or the p element?

<footer>
    <nav>
        <ul>
            ........
            ........
            ........
            ........
            ........
        </ul>
    </nav>
    <form>
        ........
        ........
        ........
    </form>
    <p>© 2012 Website.com. All rights reserved.</p>
</footer>


我已经利用W3C ARIA邮件列表问了这个问题,W3C HTML工作组成员Steve Faulkner回答了.以下是他的建议:

I had asked this question by utilizing the W3C ARIA mailing list, and Steve Faulkner, a member of W3C HTML Working Group has replied. The following is his suggestion:

我还将考虑浏览器如何将页脚元素映射到可访问性API.
在Firefox中,将页脚映射到ARIA role = contentinfo
在Webkit/safari/chrome中,如果页脚包含在section或article元素中,则将页脚映射到ARIA role = group;否则,将其映射到role = contentinfo
在IE中未映射

I would also take into account how browsers map the footer element to accessibility APIs.
In Firefox the footer is mapped to ARIA role=contentinfo
In Webkit/safari/chrome the footer is mapped to ARIA role=group if it is contained within a section or article element otherwise it is mapped to role=contentinfo
In IE it is not mapped

这样做:
< div role ="contentinfo">
   某些内容
   < footer>某些内容</footer>
</div>

So doing this:
<div role="contentinfo">
    some content
    <footer>some content</footer>
</div>

将导致在已经将页脚映射到contentinfo的浏览器中宣布嵌套的contentinfo地标.

will lead to nested contentinfo landmarks being announced in browsers that already map footer to contentinfo.

因此,我建议在主页脚中添加role = contentinfo,不要过多担心您认为不适合放在页脚中的内容.

I would suggest therefore that adding role=contentinfo to the main footer, not worrying too much about content that you think may not be appropriate being in the footer.


因此建议的方法是将role="contentinfo"添加到主footer.


So the suggested approach is adding role="contentinfo" to the main footer.

推荐答案

对于您的情况,我认为它应该位于页脚标记上.

I think it should be on the footer tag in your case.

它旨在提供有关父文档的信息,因此,如果您的页脚元素提供了父文档的良好上下文,我将使用它.

It is meant to give information about the parent document, so I would use it if your footer elements give a good context of the parent.

https://www.w3.org/TR/wai-aria/#contentinfo

这篇关于应该将role =“&quot; contentinfo&quot;设置为始终添加在页脚元素上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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