Skip to content

Commit

Permalink
Special case vertical scrolling for <html> and <body> elements
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Dec 12, 2024
1 parent 4697b1a commit 9ba9d47
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/blitz-dom/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,12 +1087,18 @@ impl Document {
return;
};

let is_html_or_body = node.raw_dom_data.downcast_element().is_some_and(|e| {
let tag = &e.name.local;
tag == "html" || tag == "body"
});

let (can_x_scroll, can_y_scroll) = node
.primary_styles()
.map(|styles| {
(
matches!(styles.clone_overflow_x(), Overflow::Scroll | Overflow::Auto),
matches!(styles.clone_overflow_y(), Overflow::Scroll | Overflow::Auto),
matches!(styles.clone_overflow_y(), Overflow::Scroll | Overflow::Auto)
|| (styles.clone_overflow_y() == Overflow::Visible && is_html_or_body),
)
})
.unwrap_or((false, false));
Expand Down

0 comments on commit 9ba9d47

Please sign in to comment.