diff --git a/Tests/LibWeb/Ref/inline-visibility-hidden.html b/Tests/LibWeb/Ref/inline-visibility-hidden.html
new file mode 100644
index 00000000000..6691a724c26
--- /dev/null
+++ b/Tests/LibWeb/Ref/inline-visibility-hidden.html
@@ -0,0 +1,2 @@
+
+hello friends and enemies
diff --git a/Tests/LibWeb/Ref/reference/inline-visibility-hidden-ref.html b/Tests/LibWeb/Ref/reference/inline-visibility-hidden-ref.html
new file mode 100644
index 00000000000..60a090765ab
--- /dev/null
+++ b/Tests/LibWeb/Ref/reference/inline-visibility-hidden-ref.html
@@ -0,0 +1 @@
+hello friends
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
index dcb6f8854e6..67fa0211904 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
+++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
@@ -605,6 +605,9 @@ void paint_text_decoration(PaintContext& context, TextPaintable const& paintable
void paint_text_fragment(PaintContext& context, TextPaintable const& paintable, PaintableFragment const& fragment, PaintPhase phase)
{
+ if (!paintable.is_visible())
+ return;
+
auto& painter = context.display_list_recorder();
if (phase == PaintPhase::Foreground) {