diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index ca474c7441..317281516e 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -117,8 +117,15 @@ bool Node::establishes_stacking_context() const if (!has_style()) return false; - if (is_root_element() || dom_node() == &document().root()) + + // We make a stacking context for the viewport. Painting and hit testing starts from here. + if (is_viewport()) return true; + + // Root element of the document (). + if (is_root_element()) + return true; + auto position = computed_values().position(); // Element with a position value absolute or relative and z-index value other than auto.