From 4b9c69ccd5dd15223da12f11798216ccc21ceab8 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 5 Feb 2019 20:34:52 +0100 Subject: [PATCH] [core] Enable innerRef on ListItem and MenuItem Required in MenuList and missed in #13722 --- packages/material-ui/src/ListItem/ListItem.js | 13 ++++++++++--- packages/material-ui/src/MenuItem/MenuItem.js | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/material-ui/src/ListItem/ListItem.js b/packages/material-ui/src/ListItem/ListItem.js index 090030847243c1..1247be5befabd7 100644 --- a/packages/material-ui/src/ListItem/ListItem.js +++ b/packages/material-ui/src/ListItem/ListItem.js @@ -86,7 +86,7 @@ export const styles = theme => ({ /** * Uses an additional container component if `ListItemSecondaryAction` is the last child. */ -function ListItem(props) { +const ListItem = React.forwardRef((props, ref) => { const { alignItems, button, @@ -158,6 +158,7 @@ function ListItem(props) { return ( {children} @@ -166,11 +167,17 @@ function ListItem(props) { ); } - return {children}; + return ( + + {children} + + ); }} ); -} +}); + +ListItem.displayName = 'ListItem'; ListItem.propTypes = { /** diff --git a/packages/material-ui/src/MenuItem/MenuItem.js b/packages/material-ui/src/MenuItem/MenuItem.js index b62cad99bf04af..3baf841d5560db 100644 --- a/packages/material-ui/src/MenuItem/MenuItem.js +++ b/packages/material-ui/src/MenuItem/MenuItem.js @@ -27,7 +27,7 @@ export const styles = theme => ({ selected: {}, }); -function MenuItem(props) { +const MenuItem = React.forwardRef((props, ref) => { const { classes, className, component, disableGutters, role, selected, ...other } = props; return ( @@ -46,10 +46,13 @@ function MenuItem(props) { }, className, )} + ref={ref} {...other} /> ); -} +}); + +MenuItem.displayName = 'MenuItem'; MenuItem.propTypes = { /**