diff --git a/CHANGELOG.md b/CHANGELOG.md
index 49595c065f..1cfc1679ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [2.3.1](https://github.com/reactjs/react-tabs/compare/v2.3.0...v2.3.1) (2019-07-10)
+
+
+### Bug Fixes
+
+* **tabs:** Handle nodes with parentNode set to undefined instead of null correctly ([0259616](https://github.com/reactjs/react-tabs/commit/0259616))
+
+
+
# [2.3.0](https://github.com/reactjs/react-tabs/compare/v2.2.2...v2.3.0) (2018-08-30)
diff --git a/package.json b/package.json
index 0dadb70887..1a3dbd6186 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-tabs",
- "version": "2.3.0",
+ "version": "2.3.1",
"description": "An accessible and easy tab component for ReactJS",
"main": "lib/index.js",
"module": "esm/index.js",
@@ -12,8 +12,8 @@
"build:esm": "babel src/ --out-dir esm/ --ignore **/__tests__,**/__mocks__",
"build:umd": "rollup -c",
"build": "npm-run-all clean:* --parallel build:*",
- "format": "eslint src --fix",
- "lint": "eslint src",
+ "format": "eslint src --fix --report-unused-disable-directives",
+ "lint": "eslint src --report-unused-disable-directives",
"precommit": "lint-staged",
"prebump": "run-s lint test",
"prepublish": "yarn run build",
diff --git a/src/components/UncontrolledTabs.js b/src/components/UncontrolledTabs.js
index 0b47e93d07..666b5ff31b 100644
--- a/src/components/UncontrolledTabs.js
+++ b/src/components/UncontrolledTabs.js
@@ -7,14 +7,18 @@ import { getPanelsCount, getTabsCount } from '../helpers/count';
import { deepMap } from '../helpers/childrenDeepMap';
import { isTabList, isTabPanel, isTab } from '../helpers/elementTypes';
+function isNode(node) {
+ return node && 'getAttribute' in node;
+}
+
// Determine if a node from event.target is a Tab element
function isTabNode(node) {
- return 'getAttribute' in node && node.getAttribute('role') === 'tab';
+ return isNode(node) && node.getAttribute('role') === 'tab';
}
// Determine if a tab node is disabled
function isTabDisabled(node) {
- return node.getAttribute('aria-disabled') === 'true';
+ return isNode(node) && node.getAttribute('aria-disabled') === 'true';
}
let canUseActiveElement;
@@ -298,7 +302,7 @@ export default class UncontrolledTabs extends Component {
this.setSelected(index, e);
return;
}
- } while ((node = node.parentNode) !== null);
+ } while ((node = node.parentNode) != null);
};
/**
diff --git a/src/components/__tests__/Tabs-test.js b/src/components/__tests__/Tabs-test.js
index d41edcbbb9..995fc8551a 100644
--- a/src/components/__tests__/Tabs-test.js
+++ b/src/components/__tests__/Tabs-test.js
@@ -1,5 +1,4 @@
/* eslint-env jest */
-/* eslint-disable react/no-multi-comp */
import React from 'react';
import Enzyme, { shallow, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';