Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Select] Fix MenuProps.PopoverClasses being overriden #35394

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mui-material/src/Menu/Menu.js
Expand Up @@ -158,7 +158,6 @@ const Menu = React.forwardRef(function Menu(inProps, ref) {

return (
<MenuRoot
classes={PopoverClasses}
onClose={onClose}
anchorOrigin={{
vertical: 'bottom',
Expand All @@ -180,6 +179,7 @@ const Menu = React.forwardRef(function Menu(inProps, ref) {
TransitionProps={{ onEntering: handleEntering, ...TransitionProps }}
ownerState={ownerState}
{...other}
classes={PopoverClasses}
>
<MenuMenuList
onKeyDown={handleListKeyDown}
Expand Down
13 changes: 13 additions & 0 deletions packages/mui-material/src/Menu/Menu.test.js
Expand Up @@ -111,6 +111,19 @@ describe('<Menu />', () => {

expect(screen.getByTestId('paper')).to.have.class('bar');
});

it('should be able to change the root element style', () => {
render(
<Menu
anchorEl={document.createElement('div')}
open
PaperProps={{ 'data-testid': 'paper' }}
PopoverClasses={{ root: 'foo' }}
/>,
);

expect(screen.getByTestId('paper').parentElement).to.have.class('foo');
});
ZeeshanTamboli marked this conversation as resolved.
Show resolved Hide resolved
});

it('should pass onClose prop to Popover', () => {
Expand Down