diff --git a/docs/src/modules/components/AppSearch.js b/docs/src/modules/components/AppSearch.js index b4a8c79ca2391b..5b9dd426068f11 100644 --- a/docs/src/modules/components/AppSearch.js +++ b/docs/src/modules/components/AppSearch.js @@ -328,57 +328,70 @@ export default function AppSearch(props) { {isOpen && ReactDOM.createPortal( - { + const html = document.querySelector('html'); + if (html) { + html.style.overflow = 'hidden'; + } + + return () => { + html.style.overflow = 'auto'; + }; }} - placeholder={`${t('algoliaSearch')}`} - transformItems={(items) => { - return items.map((item) => { - // `url` contains the domain - // but we want to link to the current domain e.g. deploy-preview-1--material-ui.netlify.app - const parseUrl = document.createElement('a'); - parseUrl.href = item.url; + > + { + return items.map((item) => { + // `url` contains the domain + // but we want to link to the current domain e.g. deploy-preview-1--material-ui.netlify.app + const parseUrl = document.createElement('a'); + parseUrl.href = item.url; - const { canonicalAs, canonicalPathname } = pathnameToLanguage( - `${parseUrl.pathname}${parseUrl.hash}`, - ); + const { canonicalAs, canonicalPathname } = pathnameToLanguage( + `${parseUrl.pathname}${parseUrl.hash}`, + ); - return { - ...item, - pathname: canonicalPathname, - as: canonicalAs, - userLanguage, - }; - }); - }} - hitComponent={DocSearchHit} - initialScrollY={typeof window !== 'undefined' ? window.scrollY : undefined} - onClose={onClose} - navigator={keyboardNavigator} - />, + return { + ...item, + pathname: canonicalPathname, + as: canonicalAs, + userLanguage, + }; + }); + }} + hitComponent={DocSearchHit} + initialScrollY={typeof window !== 'undefined' ? window.scrollY : undefined} + onClose={onClose} + navigator={keyboardNavigator} + /> + , document.body, )}