Often buttons need to be handled by JavaScript, and if done improperly it can lead to accessibility issues. In this lesson you will improve a major news organization's global header with some basic HTML and JavaScript.

Normal you should use native 'button' to make a button instead of use other html element to make a button, then you can access the button thought the keyboard.

If you use a 'div', then what you should do to make it accessible to the user by keyborad, you should add 'role', 'tabindex' & 'aria-label' to it:

<button aria-label="Help">
<i class="icon icon-help"></i>
</button> <div class="button" role="button" tabindex="0" aria-label="Menu">
<i class="icon icon-menu"></i>
</div>

If you use AngularJS,and you want press 'Enter' to get the handle event, you should add 'ng-keydown' for it:

<button aria-label="Help" ng-click="doStuff()">
<i class="icon icon-help"></i>
</button> <div class="button" role="button" tabindex="0" aria-label="Menu" ng-click="doStuff()" ng-keydown="doStuff()">
<i class="icon icon-menu"></i>
</div>

[AngularJS] Accessible Button Events的更多相关文章

  1. Part 39 AngularJS route change events

    In this video we will discuss1. Different events that are triggered when a route change occurs in an ...

  2. Angularjs学习笔记1_基本技巧

    10.AngularJS ng-click   <button ng-click="clickCounter = clickCounter + 1">Click Me! ...

  3. AngularJs MVC 详解

    为什么在前端也需要MVC 1.代码规模越来越大,切分职责是大势所趋 2.为了复用 3.为了后期维护方便 MVC的目的是为了模块化和复用 前端实现MVC的困难 1.操作DOM必须等整个页面加载完 2.多 ...

  4. AngularJS的控制器示例

    代码下载:https://files.cnblogs.com/files/xiandedanteng/angularjsCtrl.rar 代码: <!DOCTYPE HTML PUBLIC &q ...

  5. Best Practices for Speeding Up Your Web Site

    The Exceptional Performance team has identified a number of best practices for making web pages fast ...

  6. [转载]Best Practices for Speeding Up Your Web Site

    原文:http://developer.yahoo.com/performance/rules.html 提升网站加载速度的一些优化技巧,大部分在前端层面. 不知道是多久以前写的,看起来有些已经过时了 ...

  7. 札记:android手势识别,MotionEvent

    摘要 本文是手势识别输入事件处理的完整学习记录.内容包括输入事件InputEvent响应方式,触摸事件MotionEvent的概念和使用,触摸事件的动作分类.多点触摸.根据案例和API分析了触摸手势T ...

  8. [蓝牙] 3、 剖析BLE心率检测工程

    位于:<KEIL path> \ARM\Device\Nordic\nrf51822\Board\pca10001\s110\ble_app_hrs Heart Rate Example ...

  9. 如何将GridViewEX升级到UWP(Universal Windows Platform)平台

    引言 上一篇文章中,我们主要讲解了如何在保证GridView控件的用户体验基础上,扩展GridView生成GridViewEx控件,增加动态添加新分组功能等,本文在上文的基础上,介绍如何在Window ...

随机推荐

  1. Tomcat 配置问题总结

    本人是一个前端屌丝儿,最近没事研究了一下tomcat的部署问题,一下列几个实用的小技能(直接上干货了,不赘述): 1,路径引用部署 在tomcat目录下的conf/Catalina/localhost ...

  2. UVa 12171 (离散化 floodfill) Sculpture

    题意: 三维空间中有n个长方体组成的雕塑,求表面积和体积. 分析: 我们可以在最外边加一圈“空气”,然后求空气的连通块的体积,最后用总体积减去即是雕塑的体积. 还有一个很“严重”的问题就是5003所占 ...

  3. [swustoj 183] 种树

    种树(0183) 问题描述 Aconly有一块矩形的地,因为这块地里有很多石头,耕作很不方便,所以他打算在这块地上种一些果树.这块地用一个只含‘#’和‘*’的N*M的矩阵来表示,‘#’表示泥土,‘*’ ...

  4. Java [leetcode 21]Merge Two Sorted Lists

    题目描述: Merge two sorted linked lists and return it as a new list. The new list should be made by spli ...

  5. C++学习笔记:Vector容器

    vector v:初始化一个0大小的向量 vector v(10):初始化一个10个大小的向量 push_back:增加一个元素 pop:删除一个元素,不返回 front:返回第一个元素 back:返 ...

  6. 学习面试题Day04

    1.简述Java派生类中的构造方法如何为父类传递参数.     在Java中,使用super关键字加括号()的形式来为父类的构造方法提供参数,通过参数的数目和类型来决定调用哪个构造方法.如果调用的是父 ...

  7. 【Linux.Python】Python进程后台启动

    嗯,比较忧伤. 前几天写了个tornado,启动了,很开心,后来每天要用时都发现it是kill掉的.好吧,是我太蠢啦.百度了下资料 python的启动方式: 1 python yourfile.py ...

  8. Git管理命令

     1.创建分支 git branch <分支名> 2.切换分支 git checkout <分支名> 创建并切换到该分支:git checkout -b <分支名> ...

  9. App是什么,可以分为几类?及其相关解释。

     App,是应用程序,Application的缩写,事实上,严格说来,目前市面上的APP大致可分为以下十类,即移动UGC,移动搜索,移动浏览,移动支付,移动广告,移动即时信息,SNS,LBS,AR以及 ...

  10. 清空具有外键约束的表时报ERROR 1701(42000)的解决办法

    ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (`furion`.`tbl_fr ...