Skip to content

Commit

Permalink
release v1.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
claydiffrient committed Dec 11, 2016
1 parent 3b8beae commit 69e0fef
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v1.6.2 - Sun, 11 Dec 2016 17:32:03 GMT
--------------------------------------

-


v1.6.1 - Tue, 06 Dec 2016 17:16:10 GMT
--------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-modal",
"version": "1.6.1",
"version": "1.6.2",
"homepage": "https://github.com/rackt/react-modal",
"authors": [
"Ryan Florence",
Expand Down
35 changes: 30 additions & 5 deletions dist/react-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ return /******/ (function(modules) { // webpackBootstrap
var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {};
var AppElement = ExecutionEnvironment.canUseDOM ? document.body : { appendChild: function appendChild() {} };

function getParentElement(parentSelector) {
return parentSelector();
}

var Modal = React.createClass({

displayName: 'Modal',
Expand All @@ -101,7 +105,9 @@ return /******/ (function(modules) { // webpackBootstrap
closeTimeoutMS: React.PropTypes.number,
ariaHideApp: React.PropTypes.bool,
shouldCloseOnOverlayClick: React.PropTypes.bool,
role: React.PropTypes.string
parentSelector: React.PropTypes.func,
role: React.PropTypes.string,
contentLabel: React.PropTypes.string.isRequired
},

getDefaultProps: function getDefaultProps() {
Expand All @@ -110,24 +116,42 @@ return /******/ (function(modules) { // webpackBootstrap
portalClassName: 'ReactModalPortal',
ariaHideApp: true,
closeTimeoutMS: 0,
shouldCloseOnOverlayClick: true
shouldCloseOnOverlayClick: true,
parentSelector: function parentSelector() {
return document.body;
}
};
},

componentDidMount: function componentDidMount() {
this.node = document.createElement('div');
this.node.className = this.props.portalClassName;
document.body.appendChild(this.node);

var parent = getParentElement(this.props.parentSelector);
parent.appendChild(this.node);
this.renderPortal(this.props);
},

componentWillReceiveProps: function componentWillReceiveProps(newProps) {
var currentParent = getParentElement(this.props.parentSelector);
var newParent = getParentElement(newProps.parentSelector);

if (newParent !== currentParent) {
currentParent.removeChild(this.node);
newParent.appendChild(this.node);
}

this.renderPortal(newProps);
},

componentWillUnmount: function componentWillUnmount() {
if (this.props.ariaHideApp) {
ariaAppHider.show(this.props.appElement);
}

ReactDOM.unmountComponentAtNode(this.node);
document.body.removeChild(this.node);
var parent = getParentElement(this.props.parentSelector);
parent.removeChild(this.node);
elementClass(document.body).remove('ReactModal__Body--open');
},

Expand Down Expand Up @@ -432,7 +456,8 @@ return /******/ (function(modules) { // webpackBootstrap
onKeyDown: this.handleKeyDown,
onMouseDown: this.handleContentMouseDown,
onMouseUp: this.handleContentMouseUp,
role: this.props.role
role: this.props.role,
"aria-label": this.props.contentLabel
}, this.props.children));
}
});
Expand Down
Loading

0 comments on commit 69e0fef

Please sign in to comment.