Skip to content

Commit

Permalink
fix(Drawer): scroll detection issue (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbien authored Feb 21, 2024
1 parent fbed8ae commit fa39949
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/frosted-ui/src/components/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ const DrawerBody = React.forwardRef<DrawerBodyElement, DrawerBodyProps>(
React.useEffect(() => {
if (!contentRef.current) return;
const resizeObserver = new ResizeObserver((entries) => {
const contentHeight = entries[0].contentRect.height;
const contentHeight = entries[0].target.getBoundingClientRect().height;
// TODO: kinda ugly that we're reaching to a parent element here
const scrollHeight = localRef.current?.parentElement?.scrollHeight || 0;
const isScrollable = contentHeight > scrollHeight;

localRef.current?.setAttribute(
'data-is-scrollable',
isScrollable.toString(),
Expand Down

0 comments on commit fa39949

Please sign in to comment.