ARIA - 您是否需要使用ARIA-EXPANDED与ARIA-HIDDEN?

时间:2014-02-17 14:59:34

标签: wai-aria

我是ARIA角色的新手。如果我有工具提示类型功能,即如果有人单击问号按钮,则会显示更多文本,详细说明如何填写表单字段,我应该使用aria-expanded属性,aria-hidden属性还是两者?

<div class="login-form-field tt-highlight">
    <div class="error-message error-style">
        <p>Sorry you have not entered anything in the field above.</p>
    </div>
    <div class="col-xs-10 col-sm-10 col-md-10"> 
        <label for="inputTxtCustomerPostcode" class="login" />Postcode:</label>
        <input id="inputTxtCustomerPostcode" type="text" />
    </div>
    <div class="col-xs-2 col-sm-2 col-md-2">
        <a title="Please enter a valid case reference tooltip" class="login-tooltip" data-toggle="collapse" data-parent="#accordion" href="#collapseTxtCustomerPostcode" role="button" aria-pressed="false"></a>
    </div>

    <div id="collapseTxtCustomerPostcode" class="panel-collapse collapse" role="tree tooltip">
        <div class="panel-body" role="treeitem" aria-expanded="false" aria-hidden="true">
            <p>some text goes here for the tooltip</p>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:5)

使用RDF model图表来提供帮助:

RDF Data Model Diagram

aria-expanded是通过继承为treeitem角色定义的。

aria-hidden是为所有角色定义的,但有一点需要注意:

  

注意:建议作者避免对历史上阻止在所有模态中呈现的样式或属性使用aria-hidden =“false”,例如display:none或visibility:隐藏在CSS中,或隐藏属性在HTML 5中在撰写本文时,已知aria-hidden =“false”在与这些特征结合使用时工作不一致。随着未来实施的改进,在依赖这种方法之前要谨慎使用并彻底测试。

因此,aria-expanded本身就足够了。

<强>参考