From eab6a596e658b31df44102f3cf33324650ac8aef Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 26 Jul 2026 10:46:04 -0700 Subject: [PATCH] Make negative side margins zero on tables in the overflow wrapper. Fixes #4266. --- Shared/Article Rendering/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index f43399379..60d5360a2 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -64,6 +64,15 @@ function wrapTables() { wrapper.className = "nnw-overflow"; table.parentNode.insertBefore(wrapper, table); wrapper.appendChild(table); + + // A negative side margin — usually from the site's own page layout — + // would put part of the table where the wrapper can't scroll to it. + if (parseFloat(getComputedStyle(table).marginLeft) < 0) { + table.style.marginLeft = "0"; + } + if (parseFloat(getComputedStyle(table).marginRight) < 0) { + table.style.marginRight = "0"; + } } }