From ce564cb349dc50c5fb1e05e811fe4ed94a5d396a Mon Sep 17 00:00:00 2001 From: Eugene Kuzmenko Date: Sat, 19 Sep 2015 03:39:25 +0300 Subject: [PATCH] [fixed] any props not known by DropdownMenu are passed through to the underlying ul --- src/DropdownMenu.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/DropdownMenu.js b/src/DropdownMenu.js index 17ec1d8e89..fa0c355863 100644 --- a/src/DropdownMenu.js +++ b/src/DropdownMenu.js @@ -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 = ( ); - if (this.props.open) { + if (open) { list = ( - + {list} );