Accessibility fixes for Image and Text

This commit is contained in:
Nicolas Gallagher
2015-09-20 19:21:01 -07:00
parent 1d1b633317
commit 84e06564d4
3 changed files with 7 additions and 3 deletions

View File

@@ -190,10 +190,10 @@ class Image extends React.Component {
return (
<View
accessibilityLabel={accessibilityLabel}
accessibilityRole='img'
accessible={accessible}
className={'Image'}
component='div'
role='img'
style={{
...(styles.initial),
...resolvedStyle,

View File

@@ -37,6 +37,7 @@ class Text extends React.Component {
static stylePropTypes = TextStylePropTypes
static defaultProps = {
accessible: true,
component: 'span',
style: styles.initial
}

View File

@@ -24,8 +24,11 @@ export const assertProps = {
},
accessible: function (Component, props) {
// accessible
let dom = renderToDOM(<Component {...props} accessible />)
// accessible (implicit)
let dom = renderToDOM(<Component {...props} />)
assert.equal(dom.getAttribute('aria-hidden'), null)
// accessible (explicit)
dom = renderToDOM(<Component {...props} accessible />)
assert.equal(dom.getAttribute('aria-hidden'), null)
// not accessible
dom = renderToDOM(<Component {...props} accessible={false} />)