*/
+ '': PropTypes.any
+};
+
+const defaultProps = {
+ children: null,
+ className: ''
+};
+
class DataListAction extends React.Component {
constructor(props) {
super(props);
@@ -28,48 +46,27 @@ class DataListAction extends React.Component {
actions,
className,
id,
- 'aria-label': ariaLabel,
- 'aria-labelledby': ariaLabelledBy,
...props
} = this.props;
return children ? (
children
) : (
-
- }
- dropdownItems={actions}
- />
-
- );
+
+ }
+ dropdownItems={actions}
+ />
+
+ );
}
}
-DataListAction.propTypes = {
- /** Content rendered inside the DataList list */
- children: PropTypes.node,
- /** Additional classes added to the DataList list */
- className: PropTypes.string,
- /** DataList actions to show in the dropdown */
- actions: PropTypes.arrayOf(PropTypes.node).isRequired,
- /** Identify the DataList toggle number */
- id: PropTypes.string.isRequired,
- /** Adds accessible text to the DataList item */
- 'aria-labelledby': PropTypes.string.isRequired,
- /** Adds accessible text to the DataList item */
- 'aria-label': PropTypes.string.isRequired,
- /** Additional props are spread to the container
*/
- '': PropTypes.any
-};
-
-DataListAction.defaultProps = {
- children: null,
- className: ''
-};
+DataListAction.propTypes = propTypes;
+DataListAction.defaultProps = defaultProps;
export default DataListAction;
diff --git a/packages/patternfly-4/react-core/src/components/DataList/DataListContent.js b/packages/patternfly-4/react-core/src/components/DataList/DataListContent.js
index 551ef6dce55..0137fb884f4 100644
--- a/packages/patternfly-4/react-core/src/components/DataList/DataListContent.js
+++ b/packages/patternfly-4/react-core/src/components/DataList/DataListContent.js
@@ -3,19 +3,7 @@ import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly/components/DataList/data-list.css';
-const DataListContent = ({ className, children, id, isHidden, 'aria-label': ariaLabel, rowid, ...props }) => (
-
-);
-
-DataListContent.propTypes = {
+const propTypes = {
/** Content rendered inside the DataList item */
children: PropTypes.node,
/** Additional classes added to the DataList cell */
@@ -24,16 +12,30 @@ DataListContent.propTypes = {
id: PropTypes.string,
/** Flag to show if the expanded content of the DataList item is visible */
isHidden: PropTypes.bool,
- /** Adds accessible text to the DataList toggle */
+ /** Adds accessible text to the expandable context section */
'aria-label': PropTypes.string.isRequired,
/** Additional props are spread to the container
*/
'': PropTypes.any
};
-DataListContent.defaultProps = {
+const defaultProps = {
className: '',
id: '',
isHidden: false
};
+const DataListContent = ({ className, children, id, isHidden, rowid, ...props }) => (
+
+);
+
+DataListContent.propTypes = propTypes;
+DataListContent.defaultProps = defaultProps;
+
export default DataListContent;
diff --git a/packages/patternfly-4/react-core/src/components/DataList/DataListItem.js b/packages/patternfly-4/react-core/src/components/DataList/DataListItem.js
index 58fb7c791fa..d434fb7b934 100644
--- a/packages/patternfly-4/react-core/src/components/DataList/DataListItem.js
+++ b/packages/patternfly-4/react-core/src/components/DataList/DataListItem.js
@@ -3,21 +3,7 @@ import { css } from '@patternfly/react-styles';
import PropTypes from 'prop-types';
import styles from '@patternfly/patternfly/components/DataList/data-list.css';
-const DataListItem = ({ children, className, isExpanded, 'aria-labelledby': ariaLabelledBy, ...props }) => (
-
- {React.Children.map(children, child =>
- React.isValidElement(child) && React.cloneElement(child, {
- rowid: ariaLabelledBy
- })
- )}
-
-);
-
-DataListItem.propTypes = {
+const propTypes = {
/** Flag to show if the expanded content of the DataList item is visible */
isExpanded: PropTypes.bool,
/** Content rendered inside the DataList item */
@@ -30,10 +16,27 @@ DataListItem.propTypes = {
'': PropTypes.any
};
-DataListItem.defaultProps = {
+const defaultProps = {
isExpanded: false,
children: null,
className: ''
};
+const DataListItem = ({ children, className, isExpanded, 'aria-labelledby': ariaLabelledBy, ...props }) => (
+
+ {React.Children.map(children, child =>
+ React.isValidElement(child) && React.cloneElement(child, {
+ rowid: ariaLabelledBy
+ })
+ )}
+
+);
+
+DataListItem.propTypes = propTypes;
+DataListItem.defaultProps = defaultProps;
+
export default DataListItem;
diff --git a/packages/patternfly-4/react-core/src/components/DataList/DataListToggle.js b/packages/patternfly-4/react-core/src/components/DataList/DataListToggle.js
index a5820af0344..65d857365be 100644
--- a/packages/patternfly-4/react-core/src/components/DataList/DataListToggle.js
+++ b/packages/patternfly-4/react-core/src/components/DataList/DataListToggle.js
@@ -5,41 +5,24 @@ import { AngleRightIcon } from '@patternfly/react-icons';
import styles from '@patternfly/patternfly/components/DataList/data-list.css';
import { Button, ButtonVariant } from '../Button';
-const DataListToggle = ({
- className,
- isExpanded,
- 'aria-controls': ariaControls,
- 'aria-label': ariaLabel,
- 'aria-labelledby': ariaLabelledBy,
- rowid,
- id,
- ...props
-}) => (
-
-);
-
-DataListToggle.propTypes = {
+const propTypes = {
/** Additional classes added to the DataList cell */
className: PropTypes.string,
/** Flag to show if the expanded content of the DataList item is visible */
isExpanded: PropTypes.bool,
/** Identify the DataList toggle number */
id: PropTypes.string.isRequired,
- /** Adds accessible text to the DataList toggle */
- 'aria-labelledby': PropTypes.string,
- /** Adds accessible text to the DataList toggle */
- 'aria-label': PropTypes.string,
/** Allows users of some screen readers to shift focus to the controlled element. Should be used when the controlled contents are not adjacent to the toggle that controls them. */
'aria-controls': PropTypes.string,
+ /** Adds accessible text to the DataList toggle */
+ 'aria-label': PropTypes.string,
+ /** Adds accessible text to the DataList toggle */
+ 'aria-labelledby': PropTypes.string,
/** Additional props are spread to the container */
'': PropTypes.any
};
-DataListToggle.defaultProps = {
+const defaultProps = {
'aria-controls': '',
'aria-label': 'Details',
'aria-labelledby': '',
@@ -47,4 +30,37 @@ DataListToggle.defaultProps = {
isExpanded: false
};
+const DataListToggle = ({
+ className,
+ isExpanded,
+ 'aria-controls': ariaControls,
+ 'aria-label': ariaLabel,
+ 'aria-labelledby': ariaLabelledBy,
+ rowid,
+ id,
+ ...props
+}) => {
+ if (ariaLabel === "Details") {
+ ariaLabelledBy = `${rowid} ${id}`;
+ }
+
+ return (
+
+ );
+}
+
+DataListToggle.propTypes = propTypes;
+DataListToggle.defaultProps = defaultProps;
+
export default DataListToggle;
diff --git a/packages/patternfly-4/react-core/src/components/DataList/__snapshots__/DataList.test.js.snap b/packages/patternfly-4/react-core/src/components/DataList/__snapshots__/DataList.test.js.snap
index c5fbc4809b0..19b7893f05a 100644
--- a/packages/patternfly-4/react-core/src/components/DataList/__snapshots__/DataList.test.js.snap
+++ b/packages/patternfly-4/react-core/src/components/DataList/__snapshots__/DataList.test.js.snap
@@ -37,6 +37,8 @@ exports[`DataList DataListAction button 1`] = `
exports[`DataList DataListAction dropdown 1`] = `
Link,
diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/KebabToggle.js b/packages/patternfly-4/react-core/src/components/Dropdown/KebabToggle.js
index 56d50d01563..7f1e40860d5 100644
--- a/packages/patternfly-4/react-core/src/components/Dropdown/KebabToggle.js
+++ b/packages/patternfly-4/react-core/src/components/Dropdown/KebabToggle.js
@@ -3,15 +3,7 @@ import PropTypes from 'prop-types';
import { EllipsisVIcon } from '@patternfly/react-icons';
import Toggle from './Toggle';
-const defaultAriaLabel = 'Actions';
-
-const Kebab = ({ ...props }) => (
-
-
-
-);
-
-Kebab.propTypes = {
+const propTypes = {
/** HTML ID of dropdown toggle */
id: PropTypes.string,
/** Anything which can be rendered as dropdown toggle */
@@ -39,12 +31,13 @@ Kebab.propTypes = {
/** Additional props are spread to the container component */
'': PropTypes.any
};
-Kebab.defaultProps = {
+
+const defaultProps = {
id: '',
children: null,
className: '',
isOpen: false,
- 'aria-label': defaultAriaLabel,
+ 'aria-label': 'Actions',
parentRef: null,
isFocused: false,
isHovered: false,
@@ -54,4 +47,13 @@ Kebab.defaultProps = {
onToggle: Function.prototype
};
+const Kebab = ({ ...props }) => (
+
+
+
+);
+
+Kebab.propTypes = propTypes;
+Kebab.defaultProps = defaultProps;
+
export default Kebab;
diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/Toggle.js b/packages/patternfly-4/react-core/src/components/Dropdown/Toggle.js
index 1cde485c004..67341752872 100644
--- a/packages/patternfly-4/react-core/src/components/Dropdown/Toggle.js
+++ b/packages/patternfly-4/react-core/src/components/Dropdown/Toggle.js
@@ -35,13 +35,13 @@ const defaultProps = {
children: null,
className: '',
isOpen: false,
+ onToggle: Function.prototype,
parentRef: null,
isFocused: false,
isHovered: false,
isActive: false,
isDisabled: false,
- isPlain: false,
- onToggle: Function.prototype
+ isPlain: false
};
class DropdownToggle extends Component {
@@ -99,7 +99,6 @@ class DropdownToggle extends Component {
isHovered,
isDisabled,
isPlain,
- ariaHasPopup,
onToggle,
onEnter,
parentRef,
@@ -126,7 +125,6 @@ class DropdownToggle extends Component {
type={type || 'button'}
onClick={_event => onToggle && onToggle(!isOpen)}
aria-expanded={isOpen}
- aria-haspopup={ariaHasPopup}
onKeyDown={this.onKeyDown}
disabled={isDisabled}
>
diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap
index 64b28d9249e..c7bdd404022 100644
--- a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap
+++ b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Dropdown.test.js.snap
@@ -29,8 +29,8 @@ exports[`KebabToggle basic 1`] = `
className="pf-c-dropdown pf-m-expanded"
>