ESLint: Visible, non-interactive elements with click handlers must have at least one keyboard listener. (jsx-a11y/click-events-have-key)
由于ESLint检查强制非Button的 onClick 事件需要至少一个键盘事件。
键盘事件:
onKeyUp
, onKeyDown
, onKeyPress
<!-- 成功的onClick事件绑定在div上 --> <div onClick={() => {}} onKeyDown={this.handleKeyDown} /> <div onClick={() => {}} onKeyUp={this.handleKeyUp} /> <div onClick={() => {}} onKeyPress={this.handleKeyPress} />
For GitHub:https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
WARNING:
ESLint: Static HTML elements with event handlers require a role. (jsx-a11y/no-static-element-interactions
Fixed:
<div role="button" onClick={() => {}} onKeyDown={this.handleKeyDown} />
WARNING:
ESLint: Elements with the 'button' interactive role must be focusable. (jsx-a11y/interactive-supports-focus)
Fixed:
<div role="button" tabIndex="0" onClick={() => {}} onKeyDown={this.handleKeyDown} />
WARNING:
ESLint: Missing parentheses around multilines JSX (react/jsx-wrap-multilines)
Final Fixed:
{ midBoxInfo.icons.map((v, i) => ( <span key={i} role="button" tabIndex="0" onClick={() => this.goLink(v.link)} onKeyPress={() => this.goLink(v.link)} > <img alt="" src={require(`../../../static/images/for/${v.icon}`)} /> </span> )) }
相关推荐
所有这些都会显示错误- Visible, non-interactive elements with click handlers must have at least one keyboard listener.` const Div = styled . div `` ;< Div xss=removed> null } / > ; const Div = styled ...
处理程序
python库。 资源全名:pydap.handlers.netcdf-0.6.1-py2.6.egg
资源来自pypi官网。 资源全名:pydap.handlers.sql-0.1.1-py2.7.egg
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) at org.apache.axis.transport.http.AxisServlet.doPost...
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用
资源来自pypi官网。 资源全名:lambda_handlers-0.0.1rc0.tar.gz
资源分类:Python库 所属语言:Python 资源全名:django-ohm2-handlers-light-0.1.19.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
with polymorphism ............. 25 The singly rooted hierarchy .............................. 28 Containers ............................ 28 Parameterized types (Generics) ..29 Object creation & life...
handlers.js
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
Getting Started with Apache.................................37 Installing Apache..............................................................................................38 Getting Apache............
All packages now have version suffix (e.g. EurekaLogCore240.bpl). No files are copied to \bin folder of IDE. Run-time package (EurekaLogCore) is copied to Windows\System32 folder. Refer to help for ...
window.postMessage的功能是允许程序员跨域在两个窗口/frames间发送数据信息。基本上,它就像是跨域的AJAX,但不是浏览器跟服务器之间交互,而是在两个客户端之间通信。让我们来看一下window.postMessage是如何工作...
■Chapter 17: Exploring Handlers ................................................................... 469 ■Chapter 18: Exploring the AsyncTask.............................................................
2.3.9 One Change at a Time . . . . . . . . . 12 2.3.10 Keep an Audit Trail . . . . . . . . 12 2.3.11 Get a Fresh View . . . . . . . . . . . 13 2.3.12 If You Didn’t Fix it, it Ain’t Fixed . . . . . ...
android 3开发手册,Chapter 1: Introducing the Android Computing Platform .............................................................................■Chapter 13: Exploring Handlers ....................