Skip to content

Commit

Permalink
fix: allow user optin to vh polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Aug 29, 2022
1 parent 732195d commit ec23eb0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .changeset/itchy-deers-smash.md
@@ -0,0 +1,23 @@
---
"@chakra-ui/styled-system": patch
"@chakra-ui/theme": patch
---

Allow user optin to the 100vh polyfill because it's only useful in absolute or
fixed layout modes.

Chakra new polyfills the `100vh` attribute to use either the literal `100vh` or
`-webkit-fill-available` where supported. To use this feature, set the height
values to `$100vh` instead of `100vh`.

```jsx live=false
// Might not work in all cases
<Box minHeight="100vh" position="absolute">
Test
</Box>

// Polyfilled version ensures 100vh work correctly
<Box minHeight="$100vh" position="absolute">
Test
</Box>
```
Expand Up @@ -41,7 +41,7 @@ export const transformFunctions = {
return value
},
vh(value: number | string) {
return value === "100vh" ? "var(--chakra-vh)" : value
return value === "$100vh" ? "var(--chakra-vh)" : value
},
px(value: number | string) {
if (value == null) return value
Expand Down
2 changes: 1 addition & 1 deletion packages/components/theme/src/components/modal.ts
Expand Up @@ -87,7 +87,7 @@ function getSize(value: string) {
return definePartsStyle({
dialog: {
maxW: "100vw",
minH: "100vh",
minH: "$100vh",
my: "0",
borderRadius: "0",
},
Expand Down

1 comment on commit ec23eb0

@vercel
Copy link

@vercel vercel bot commented on ec23eb0 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.