Skip to content

Commit

Permalink
Release v3.7.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
diasbruno committed Dec 10, 2018
1 parent 2ae092a commit d4a8a32
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
v3.7.1 - Mon, 10 Dec 2018 13:12:33 UTC
--------------------------------------

- [2ae092a](../../commit/2ae092a) [fixed] Allow empty classNames for body (#720)
- [8d8f476](../../commit/8d8f476) React-Modal: chromeHeadless use
- [fc53400](../../commit/fc53400) [fixed] Allow ReactDOM.createPortal to be mocked in tests
- [6a6bcf7](../../commit/6a6bcf7) [fixed] Render `testId` property
- [1b561fc](../../commit/1b561fc) [fixed] if tabbable element is undefined, focus head or tail based on shiftKey
- [86632aa](../../commit/86632aa) [fixed] check if element exists before focusing in scopeTab helper


v3.6.1 - Tue, 25 Sep 2018 11:47:45 UTC
--------------------------------------

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": "3.6.1",
"version": "3.7.1",
"homepage": "https://github.com/reactjs/react-modal",
"authors": [
"Ryan Florence",
Expand Down
24 changes: 20 additions & 4 deletions dist/react-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,10 @@ var portalClassName = exports.portalClassName = "ReactModalPortal";
var bodyOpenClassName = exports.bodyOpenClassName = "ReactModal__Body--open";

var isReact16 = _reactDom2.default.createPortal !== undefined;
var createPortal = isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;

var getCreatePortal = function getCreatePortal() {
return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
};

function getParentElement(parentSelector) {
return parentSelector();
Expand All @@ -569,6 +572,7 @@ var Modal = function (_Component) {
}, _this.portalRef = function (ref) {
_this.portal = ref;
}, _this.renderPortal = function (props) {
var createPortal = getCreatePortal();
var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({ defaultStyles: Modal.defaultStyles }, props)), _this.node);
_this.portalRef(portal);
}, _temp), _possibleConstructorReturn(_this, _ret);
Expand Down Expand Up @@ -652,6 +656,7 @@ var Modal = function (_Component) {
this.node = document.createElement("div");
}

var createPortal = getCreatePortal();
return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({
ref: this.portalRef,
defaultStyles: Modal.defaultStyles
Expand Down Expand Up @@ -1629,7 +1634,7 @@ var ModalPortal = function (_Component) {

// Remove classes.

classList.remove(document.body, bodyOpenClassName);
bodyOpenClassName && classList.remove(document.body, bodyOpenClassName);

htmlOpenClassName && classList.remove(document.getElementsByTagName("html")[0], htmlOpenClassName);

Expand Down Expand Up @@ -1843,7 +1848,7 @@ var ModalPortal = function (_Component) {

// Add classes.

classList.add(document.body, bodyOpenClassName);
bodyOpenClassName && classList.add(document.body, bodyOpenClassName);

htmlOpenClassName && classList.add(document.getElementsByTagName("html")[0], htmlOpenClassName);

Expand Down Expand Up @@ -1888,7 +1893,9 @@ var ModalPortal = function (_Component) {
onClick: this.handleContentOnClick,
role: this.props.role,
"aria-label": this.props.contentLabel
}, this.attributesFromObject("aria", this.props.aria || {}), this.attributesFromObject("data", this.props.data || {})),
}, this.attributesFromObject("aria", this.props.aria || {}), this.attributesFromObject("data", this.props.data || {}), {
"data-testid": this.props.testId
}),
this.props.children
)
);
Expand Down Expand Up @@ -2117,6 +2124,15 @@ function scopeTab(node, event) {
x += shiftKey ? -1 : 1;
}

// If the tabbable element does not exist,
// focus head/tail based on shiftKey
if (typeof tabbable[x] === "undefined") {
event.preventDefault();
target = shiftKey ? tail : head;
target.focus();
return;
}

event.preventDefault();

tabbable[x].focus();
Expand Down
4 changes: 2 additions & 2 deletions dist/react-modal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-modal",
"version": "3.6.1",
"version": "3.7.1",
"description": "Accessible modal dialog component for React.JS",
"main": "./lib/index.js",
"module": "./lib/index.js",
Expand Down

0 comments on commit d4a8a32

Please sign in to comment.