Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

feat: background scaling backwards compatible (#412)

Emil Kowalski01d65d3f87c5
diff --git a/src/use-scale-background.ts b/src/use-scale-background.ts
index a578a69..50b9d97 100644
--- a/src/use-scale-background.ts
+++ b/src/use-scale-background.ts
@@ -17,7 +17,9 @@ export function useScaleBackground() {
React.useEffect(() => {
if (isOpen && shouldScaleBackground) {
if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);
- const wrapper = document.querySelector('[data-vaul-drawer-wrapper]') as HTMLElement;
+ const wrapper =
+ (document.querySelector('[data-vaul-drawer-wrapper]') as HTMLElement) ||
+ (document.querySelector('[vaul-drawer-wrapper]') as HTMLElement);
const bodyAndWrapperCleanup = chain(
setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, { background: 'black' }) : noop,