Skip to content

[Drawer]: ModalProps.slotProps broken with introduction slotProps #45446

Closed
@kgregory

Description

@kgregory

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-oda7qyqd-3t9qvtsb?file=Demo.tsx
  2. Observe that ModalProps.slotProps.backdrop.id is set
  3. Observe that the rendered backdrop has no id
  4. Switch the demo to use 6.4.5
  5. Observe that the rendered backdrop has an id

Current behavior

As noted in the original PR, ModalProps.slotProps.backdrop are not making it into slotProps.backdrop .

This no longer seems to apply the props to the backdrop:

          <Drawer
            anchor={anchor}
            open={state[anchor]}
            onClose={toggleDrawer(anchor, false)}
            ModalProps={{
              slotProps: {
                backdrop: {
                  id: 'where-has-my-id-gone',
                },
              },
            }}
          >

To fix this, the dev needs to now use slotProps.backdrop on the Drawer, but it's a breaking change.

Expected behavior

It should apply ModalProps.slotProps.backdrop to the backdrop.

Context

No response

Your environment

npx @mui/envinfo
  System:
    OS: Windows 11 10.0.26100
  Binaries:
    Node: 20.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.10.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Chromium (133.0.3065.82)
  npmPackages:
    typescript: 5.7.3 => 5.7.3

Search keywords: Drawer, slotProps

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: drawerThis is the name of the generic UI component, not the React module!status: expected behaviorDoes not imply the behavior is intended. Just that we know about it and can't work around itv6.x

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions