diff --git a/src/components/Search/SearchModal.tsx b/src/components/Search/SearchModal.tsx index 32d7e2f26..255072885 100644 --- a/src/components/Search/SearchModal.tsx +++ b/src/components/Search/SearchModal.tsx @@ -28,6 +28,18 @@ export function SearchModal(props: SearchModalProps) { [], ); + // Add a global class on the body when the search modal is open + const isSearchOpened = state !== null; + React.useEffect(() => { + if (isSearchOpened) { + document.body.classList.add('search-open'); + } + + return () => { + document.body.classList.remove('search-open'); + }; + }, [isSearchOpened]); + if (state === null) { return null; }