Skip to content

Commit 1a16a91

Browse files
committed
Enforce vh or dvh as fill-available cannot be used in calc()
1 parent 2262879 commit 1a16a91

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/theme.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export const themeOverrides = {
339339
dialog: {
340340
outline: "unset",
341341
minH: "calc(var(--chakra-vh) - 4rem)",
342-
maxW: "calc(100vw - 4rem)",
342+
maxW: "calc(var(--chakra-vw) - 4rem)",
343343
my: "2rem",
344344
borderRadius: "3xl",
345345
overflow: "hidden",
@@ -355,6 +355,17 @@ export const themeOverrides = {
355355
},
356356
styles: {
357357
global: {
358+
// supporting older browsers but avoiding fill-available CSS as it doesn't work https://github.com/chakra-ui/chakra-ui/blob/073bbcd21a9caa830d71b61d6302f47aaa5c154d/packages/components/css-reset/src/css-reset.tsx#L5
359+
":root": {
360+
"--chakra-vh": "100vh",
361+
"--chakra-vw": "100vw",
362+
},
363+
"@supports (height: 100dvh) and (width: 100dvw) ": {
364+
":root": {
365+
"--chakra-vh": "100dvh",
366+
"--chakra-vw": "100dvw",
367+
},
368+
},
358369
".rdg": {
359370
contain: "size layout style paint",
360371
borderRadius: "lg",

0 commit comments

Comments
 (0)