[HTML5] Using the tabindex attribute for keyboard accessibility
You can make any element keyboard interactive with the HTML tabindex attribute. But you might need a little extra JavaScript and ARIA to support keyboards and screen readers. For more on using tabindex in practice, check out focus management lesson.
tabindex="0":
Make it accessable by click "tab" on keyboard.
tabindex="-1":
Make it uaccessable by clicking "tab" on keyboard, but still can send fouse by Javascript. Why -1 can be useful. It has pulled it out of the tab order, which is handy if, say, that button is in an inactive screen in a web application or behind a modal window. You might have some reason to pull it out of the tab order, so that a screen reader or keyboard user isn't landing on something that they can't use, for whatever reason.
<div tabindex="100" id="fakeBtn" class="btn" role="button">Button</div> <button id="realBtn" class="btn">Button</button>
相关文章
- HTML5至少目前有5件事做不成
- 怎样用JavaScript和HTML5 Canvas绘制图表
- HTML5相关文章和资源
- 基于HTML5及WebGl下生成的json格式的工控SCADA风机叶轮旋转
- HTML5应用程序缓存实现离线Web网页或应用
- HTML5之dir属性
- [HTML5] Semantics for accessibility
- [Javascript] Drawing Styles on HTML5 Canvas
- [HTML5] Semantics for accessibility
- Cross domain issue for an pure HTML5 application on SAP Cloud Platform
- HTML5系列之——applicationCache对象
- 图片本地预览 flash html5
- HTML5——周技能检测——菜单编辑——2022年11月22日(考完)