Skip to content

Commit

Permalink
[fixed] any props not known by DropdownMenu are passed through to the…
Browse files Browse the repository at this point in the history
… underlying ul
  • Loading branch information
thealjey committed Sep 19, 2015
1 parent 6f6fed1 commit ce564cb
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,36 @@ class DropdownMenu extends React.Component {
}

render() {
const items = ValidComponentChildren.map(this.props.children, child => {
let {
children,
onKeyDown,
onSelect
} = child.props || {};
let {children, onSelect, pullRight, className, labelledBy, open, onClose, ...props} = this.props;

const items = ValidComponentChildren.map(children, child => {
let childProps = child.props || {};

return React.cloneElement(child, {
onKeyDown: createChainedFunction(onKeyDown, this.handleKeyDown),
onSelect: createChainedFunction(onSelect, this.props.onSelect)
}, children);
onKeyDown: createChainedFunction(childProps.onKeyDown, this.handleKeyDown),
onSelect: createChainedFunction(childProps.onSelect, onSelect)
}, childProps.children);
});

const classes = {
'dropdown-menu': true,
'dropdown-menu-right': this.props.pullRight
'dropdown-menu-right': pullRight
};

let list = (
<ul
className={classNames(this.props.className, classes)}
className={classNames(className, classes)}
role="menu"
aria-labelledby={this.props.labelledBy}
aria-labelledby={labelledBy}
{...props}
>
{items}
</ul>
);

if (this.props.open) {
if (open) {
list = (
<RootCloseWrapper noWrap onRootClose={this.props.onClose}>
<RootCloseWrapper noWrap onRootClose={onClose}>
{list}
</RootCloseWrapper>
);
Expand Down

0 comments on commit ce564cb

Please sign in to comment.