[ARIA] What is Accessible Name Calculation?

What's in a name? In this lesson, I'll explain the concept of naming interactive elements for screen reader users, including forms, buttons, and links. You'll learn how to debug accessible names and descriptions using the Chrome Accessibility Developer Tools (previously a Canary experiment, now in Chrome), using multiple labeling techniques. We'll also listen to the effects of proper accessible names and descriptions in Voiceover and Safari.

For more information and the nitty-gritty browser implementation algorithm, refer to WAI-ARIA 1.1:

 

Search box:

    <form class="search">
        <input aria-labelledby="search-button" />
        <button id="search-button">
            <span aria-hidden="true" class="icon icon-search"></span>
            <span class="visuallyhidden">Search</span>
        </button>
    </form>

Input field is labelled by the button, button is labelled by the text content.

 

Read more link:

<a href="#" aria-labelledby="readmore1 readMoreLabel1">
    <span id="readmore1">Read more</span>
    <span id="readMoreLabel1" class="visuallyhidden"> articles about cute animals</span>
</a>

aria-labelledby can accpet multi ids.

 

DIalog:

<dialog open role="dialog" aria-label="Newsletter sign up">
        <!-- For custom button, we can use aria-label & aria-describedby-->
        <custom-button role="button" tabindex="0" aria-label="Cancel" aria-describedby="cancelNote">
            X
        </custom-button>
        <fieldset>
             <!-- it is good to use legend to tell users what this form is all about-->
            <legend>
                <h2>Sign up your favorite friends for our newsletter!</h2>
            </legend>
            <div>
                <!-- label for-->
                <label for="dogs">Dog</label>
                <input type="text" id="dogs" name="dogs" />
            </div>

            <div>
                 <!-- best: using both for & label wrapping-->
                <label for="cats">
                    Cat
                    <input type="text" id="cats" name="cats" />
                </label>
            </div>

            <div>
                <!-- who else will be the label -->
                <label>
                    Who else?
                    <input type="text" placeholder="e.g. Frank the Lizard" name="superfriends" />
                </label>
            </div>
            <div>
                <input type="submit" value="Submit" />
            </div>
        </fieldset>
        <p id="cancelNote">Closing this dialog will cancel your submission.</p>
    </dialog>

 

转载于:https://www.cnblogs.com/Answer1215/p/11523236.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值