mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 22:55:56 +08:00
Accessibility fixes for Image and Text
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -37,6 +37,7 @@ class Text extends React.Component {
|
||||
static stylePropTypes = TextStylePropTypes
|
||||
|
||||
static defaultProps = {
|
||||
accessible: true,
|
||||
component: 'span',
|
||||
style: styles.initial
|
||||
}
|
||||
|
||||
@@ -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} />)
|
||||
|
||||
Reference in New Issue
Block a user