react-a11y
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -0,1 +1,7 @@ | ||
v0.0.4 - Mon, 19 Jan 2015 15:57:06 GMT | ||
-------------------------------------- | ||
- [3b7f988](../../commit/3b7f988) [fixed] missing interactive tags | ||
v0.0.3 - Mon, 19 Jan 2015 15:36:02 GMT | ||
@@ -2,0 +8,0 @@ -------------------------------------- |
@@ -7,2 +7,4 @@ "use strict"; | ||
button: true, | ||
input: true, | ||
textarea: true, | ||
a: function a(props) { | ||
@@ -17,6 +19,2 @@ return typeof props.href === "string"; | ||
var altIsRedundant = function (alt) { | ||
return alt.match("image"); | ||
}; | ||
var isInteractive = function (tagName, props) { | ||
@@ -27,39 +25,2 @@ var tag = INTERACTIVE[tagName]; | ||
var hasClick = function (props) { | ||
return typeof props.onClick === "function"; | ||
}; | ||
var hasRole = function (props) { | ||
return typeof props.role === "string"; | ||
}; | ||
var hasTabIndex = function (props) { | ||
return typeof props.tabIndex === "string"; | ||
}; | ||
var needsAriaRole = function (tagName, props) { | ||
return !isInteractive(tagName, props) && hasClick(props) && !hasRole(props); | ||
}; | ||
var needsTabIndex = function (tagName, props) { | ||
return !isInteractive(tagName, props) && hasClick(props) && !hasTabIndex(props); | ||
}; | ||
var hrefIsHash = function (props) { | ||
return props.href === "#"; | ||
}; | ||
var needsButtonRole = function (props) { | ||
return hasClick(props) && hrefIsHash(props); | ||
}; | ||
var hasLabel = function (props) { | ||
return typeof props["aria-label"] === "string"; | ||
}; | ||
var hasLabelledBy = function (props) { | ||
return typeof props["aria-labelled-by"] === "string"; | ||
}; | ||
var hasChildTextNode = function (props, children) { | ||
@@ -73,6 +34,2 @@ var hasText = false; | ||
var needsLabel = function (props, children) { | ||
return hasClick(props) && !(hasLabel(props) || hasLabelledBy(props) || hasChildTextNode(props, children)); | ||
}; | ||
exports.props = { | ||
@@ -83,3 +40,3 @@ onClick: { | ||
test: function test(tagName, props, children) { | ||
return !needsAriaRole(tagName, props); | ||
return !(!isInteractive(tagName, props) && !props.role); | ||
} | ||
@@ -91,3 +48,3 @@ }, | ||
test: function test(tagName, props, children) { | ||
return !needsTabIndex(tagName, props); | ||
return !(!isInteractive(tagName, props) && !props.tabIndex); | ||
} | ||
@@ -99,3 +56,3 @@ }, | ||
test: function test(tagName, props, children) { | ||
return !needsLabel(props, children); | ||
return props["aria-label"] || props["aria-labelled-by"] || hasChildTextNode(props, children); | ||
} | ||
@@ -124,5 +81,5 @@ }, | ||
HASH_HREF_NEEDS_BUTTON: { | ||
msg: "You have a click handler on an anchor with an `href` DOM property and no `role` DOM property. Add `role=\"button\"` to your markup, or you should probably just use a `<button/>`.", | ||
msg: "You have an anchor with `href=\"#\"` and no `role` DOM property. Add `role=\"button\"` or better yet, use a `<button/>`.", | ||
test: function test(tagName, props, children) { | ||
return !needsButtonRole(props); | ||
return !(!props.role && props.href === "#"); | ||
} | ||
@@ -144,3 +101,3 @@ } | ||
test: function test(tagName, props, children) { | ||
return !(hasAlt(props) && altIsRedundant(props.alt)); | ||
return !(hasAlt(props) && props.alt.match("image")); | ||
} | ||
@@ -147,0 +104,0 @@ } |
{ | ||
"name": "react-a11y", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Warns about potential accessibility issues with your React elements.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14196
269