super-image
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -81,2 +81,9 @@ 'use strict'; | ||
// If `alt` is not empty, `none` or `presentation` can not be specified. | ||
// So delete the `role` attribute. | ||
// @see https://www.w3.org/TR/html-aria/#img-alt | ||
if (props.alt && props.role !== 'img') { | ||
props.role = null; | ||
} | ||
// Render picture element if `sources` property exists | ||
@@ -145,3 +152,3 @@ if (this.props.sources.length > 0) { | ||
return React.createElement('div', { | ||
role: 'img', | ||
role: this.props.alt ? 'img' : this.props.role || 'img', | ||
'aria-label': this.props.alt, | ||
@@ -177,2 +184,3 @@ className: this.props.className, | ||
alt: PropTypes.string, | ||
role: PropTypes.oneOf(['none', 'presentation']), | ||
className: PropTypes.string, | ||
@@ -188,2 +196,3 @@ fit: PropTypes.oneOf(['contain', 'cover']), | ||
alt: '', | ||
role: null, | ||
className: '', | ||
@@ -190,0 +199,0 @@ fit: null, |
{ | ||
"name": "super-image", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "React component that render `<img>` with nicer interface", | ||
@@ -32,15 +32,15 @@ "main": "lib/index.js", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-power-assert": "^1.0.0", | ||
"babel-preset-power-assert": "^2.0.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babelify": "^8.0.0", | ||
"browserify": "^14.4.0", | ||
"browserify": "^15.0.0", | ||
"codecov": "^3.0.0", | ||
"eslint": "^4.10.0", | ||
"eslint": "^4.13.1", | ||
"eslint-config-fresh": "^2.3.0", | ||
"eslint-config-fresh-react": "^2.6.0", | ||
"eslint-config-xo-react": "^0.14.0", | ||
"eslint-config-fresh-react": "^2.8.1", | ||
"eslint-config-xo-react": "^0.16.0", | ||
"eslint-config-xo-space": "^0.17.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.2", | ||
"eslint-plugin-react": "^7.4.0", | ||
"karma": "^1.7.1", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.6.1", | ||
"karma": "^2.0.0", | ||
"karma-browserify": "^5.1.1", | ||
@@ -51,13 +51,13 @@ "karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"mocha": "^4.0.1", | ||
"mocha": "^5.0.0", | ||
"power-assert": "^1.4.4", | ||
"prop-types": "^15.6.0", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0" | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0" | ||
}, | ||
"peerDependencies": { | ||
"prop-types": "^15.6.0", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0" | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0" | ||
} | ||
} |
# SuperImage | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/openfresh/super-image.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/openfresh/super-image.svg?branch=master)](https://travis-ci.org/openfresh/super-image) | ||
@@ -72,2 +73,3 @@ [![devDependency Status](https://david-dm.org/openfresh/super-image/dev-status.svg)](https://david-dm.org/openfresh/super-image?type=dev) | ||
| alt | String | Alternative text for `<img>` | `""` | No | | ||
| role | String | WAI-ARIA for `<img>` | - | No | | ||
| className | String | `className` property for component | `""` | No | | ||
@@ -74,0 +76,0 @@ | flexible | Boolean | Make component fluid | `false` | No | |
@@ -10,2 +10,4 @@ // Type definitions for super-image 2.1.1 | ||
sources?: React.SourceHTMLAttributes<HTMLSourceElement>[]; | ||
alt?: string; | ||
role?: 'none' | 'presentation'; | ||
fit?: 'contain' | 'cover'; | ||
@@ -12,0 +14,0 @@ fitFallback?: boolean; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49662
16
643
82
1