Skip to content

Commit d4a8a32

Browse files
committed
Release v3.7.1.
1 parent 2ae092a commit d4a8a32

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
v3.7.1 - Mon, 10 Dec 2018 13:12:33 UTC
2+
--------------------------------------
3+
4+
- [2ae092a](../../commit/2ae092a) [fixed] Allow empty classNames for body (#720)
5+
- [8d8f476](../../commit/8d8f476) React-Modal: chromeHeadless use
6+
- [fc53400](../../commit/fc53400) [fixed] Allow ReactDOM.createPortal to be mocked in tests
7+
- [6a6bcf7](../../commit/6a6bcf7) [fixed] Render `testId` property
8+
- [1b561fc](../../commit/1b561fc) [fixed] if tabbable element is undefined, focus head or tail based on shiftKey
9+
- [86632aa](../../commit/86632aa) [fixed] check if element exists before focusing in scopeTab helper
10+
11+
112
v3.6.1 - Tue, 25 Sep 2018 11:47:45 UTC
213
--------------------------------------
314

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-modal",
3-
"version": "3.6.1",
3+
"version": "3.7.1",
44
"homepage": "https://github.com/reactjs/react-modal",
55
"authors": [
66
"Ryan Florence",

dist/react-modal.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,10 @@ var portalClassName = exports.portalClassName = "ReactModalPortal";
542542
var bodyOpenClassName = exports.bodyOpenClassName = "ReactModal__Body--open";
543543

544544
var isReact16 = _reactDom2.default.createPortal !== undefined;
545-
var createPortal = isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
545+
546+
var getCreatePortal = function getCreatePortal() {
547+
return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
548+
};
546549

547550
function getParentElement(parentSelector) {
548551
return parentSelector();
@@ -569,6 +572,7 @@ var Modal = function (_Component) {
569572
}, _this.portalRef = function (ref) {
570573
_this.portal = ref;
571574
}, _this.renderPortal = function (props) {
575+
var createPortal = getCreatePortal();
572576
var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({ defaultStyles: Modal.defaultStyles }, props)), _this.node);
573577
_this.portalRef(portal);
574578
}, _temp), _possibleConstructorReturn(_this, _ret);
@@ -652,6 +656,7 @@ var Modal = function (_Component) {
652656
this.node = document.createElement("div");
653657
}
654658

659+
var createPortal = getCreatePortal();
655660
return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({
656661
ref: this.portalRef,
657662
defaultStyles: Modal.defaultStyles
@@ -1629,7 +1634,7 @@ var ModalPortal = function (_Component) {
16291634

16301635
// Remove classes.
16311636

1632-
classList.remove(document.body, bodyOpenClassName);
1637+
bodyOpenClassName && classList.remove(document.body, bodyOpenClassName);
16331638

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

@@ -1843,7 +1848,7 @@ var ModalPortal = function (_Component) {
18431848

18441849
// Add classes.
18451850

1846-
classList.add(document.body, bodyOpenClassName);
1851+
bodyOpenClassName && classList.add(document.body, bodyOpenClassName);
18471852

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

@@ -1888,7 +1893,9 @@ var ModalPortal = function (_Component) {
18881893
onClick: this.handleContentOnClick,
18891894
role: this.props.role,
18901895
"aria-label": this.props.contentLabel
1891-
}, this.attributesFromObject("aria", this.props.aria || {}), this.attributesFromObject("data", this.props.data || {})),
1896+
}, this.attributesFromObject("aria", this.props.aria || {}), this.attributesFromObject("data", this.props.data || {}), {
1897+
"data-testid": this.props.testId
1898+
}),
18921899
this.props.children
18931900
)
18941901
);
@@ -2117,6 +2124,15 @@ function scopeTab(node, event) {
21172124
x += shiftKey ? -1 : 1;
21182125
}
21192126

2127+
// If the tabbable element does not exist,
2128+
// focus head/tail based on shiftKey
2129+
if (typeof tabbable[x] === "undefined") {
2130+
event.preventDefault();
2131+
target = shiftKey ? tail : head;
2132+
target.focus();
2133+
return;
2134+
}
2135+
21202136
event.preventDefault();
21212137

21222138
tabbable[x].focus();

dist/react-modal.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-modal",
3-
"version": "3.6.1",
3+
"version": "3.7.1",
44
"description": "Accessible modal dialog component for React.JS",
55
"main": "./lib/index.js",
66
"module": "./lib/index.js",

0 commit comments

Comments
 (0)