diff --git a/app/assets/stylesheets/framework/markdown_area.scss b/app/assets/stylesheets/framework/markdown_area.scss
index 62782de5402fed57d7cb2e1266e159fcdb133cb5..cd8c69f5be2783b734f221dca33074bf98f85314 100644
--- a/app/assets/stylesheets/framework/markdown_area.scss
+++ b/app/assets/stylesheets/framework/markdown_area.scss
@@ -137,8 +137,11 @@
   border-radius: $border-radius-default $border-radius-default 0 0;
 }
 
+/* these two styles are important to prevent certain LaTeX from
+   hijacking a page: https://gitlab.com/gitlab-org/gitlab/-/issues/394770
+*/
 .math-content-inline {
-  overflow: auto;
+  overflow: hidden;
   display: inline-flex;
 }