diff --git a/docs/src/modules/components/AppFrame.js b/docs/src/modules/components/AppFrame.js index 9f0d45acc58879..08d1eb2c232786 100644 --- a/docs/src/modules/components/AppFrame.js +++ b/docs/src/modules/components/AppFrame.js @@ -165,6 +165,9 @@ export default function AppFrame(props) { const [mobileOpen, setMobileOpen] = React.useState(false); const [settingsOpen, setSettingsOpen] = React.useState(false); + const closeDrawer = React.useCallback(() => setMobileOpen(false), []); + const openDrawer = React.useCallback(() => setMobileOpen(true), []); + const { activePage } = React.useContext(PageContext); const disablePermanent = activePage?.disableDrawer === true || disableDrawer === true; @@ -229,8 +232,8 @@ export default function AppFrame(props) { setMobileOpen(false)} - onOpen={() => setMobileOpen(true)} + onClose={closeDrawer} + onOpen={openDrawer} mobileOpen={mobileOpen} /> {children}