我正在开发一个投票应用程序,我正在努力使其尽可能易于访问。但我无法理解最好的方法是什么。
我有一个问题,一个关于这个问题的解释和两个可供选择的选项。我构建它的当前方式是这样的:
<h2>Do you like apples?</h2>
<p>Apples are a type of fruit and can be sweet or sour.<p>
<button aria-pressed="false" aria-role="button" aria-label="Yes, I like apples">yes</button>
<button aria-pressed="false" aria-role="button" aria-label="No, I don't like apples>no</button>
使用一个小脚本,我将确保按下的按钮获得一个aria-press="true". 但是后来让我感到震惊的是,为此使用单选按钮可能会更好?
<h2 id="q-appleTitle" for="q-apple">Do you like apples?</h2>
<p id="q-appleDesc" >Apples are a type of fruit and can be sweet or sour.<p>
<input type="radio" id="qYes" value="yes" aria-describedby="q-appleTitle q-appleDesc">
<label aria-label="Yes, I like apples" for="qYes">Yes</label>
<input type="radio" id="qNo" value="no" aria-describedby="q-appleTitle q-appleDesc">
<label aria-label="No, I don't like apples" for="qNo">No</label>
做这样的事情的首选方法是什么?