AspectRatio is forcing its img, video children to behave objectFit="cover" #4347
Labels
needs triage
Issues and pull requests that need triage attention
Type: Bug 🐛
Something isn't working
workaround available ✌️
Issue has quick hack or walk-around
Description
When I set
<Image objectFit="contain" />
, I expect it to happen. But if I render it inside an<AspectRatio />
, it will always beobjectFit="cover"
.Link to Reproduction
https://codesandbox.io/s/awesome-ritchie-ec8n9?file=/src/index.js
Steps to reproduce
Chakra UI Version
1.6.4
Browser
No response
Operating System
Additional Information
Source:
https://github.com/chakra-ui/chakra-ui/blob/%40chakra-ui/react%401.6.4/packages/layout/src/aspect-ratio.tsx#L62-L64
Tracing it back, these lines were first introduced in this commit: c91fdf3#diff-ce7500ee881128fd4e892b90abbccad46958754956da612389d3d5e4f75ebec8
In my opinion, the
objectFit
of its img, video children should be configurable directly on its children, not on the<AspectRatio />
itself.The text was updated successfully, but these errors were encountered: