From 8280585e70b86b56e1d8621775eb7ab7c8e36ba6 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 18 Mar 2026 00:52:07 +0800 Subject: [PATCH] compat(css): fix table layout regression issue, closes #3551 (#3556) --- apps/readest-app/src/utils/style.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 9cf19e9e..9c0d6686 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -190,9 +190,11 @@ const getColorStyles = ( } table { overflow: auto; - table-layout: fixed; display: table !important; } + table:has(> colgroup) { + table-layout: fixed; + } /* code */ body.theme-dark code { ${isDarkMode ? `color: ${fg}cc;` : ''} @@ -910,16 +912,6 @@ export const applyTableStyle = (document: Document) => { } } - const computedTableStyle = window.getComputedStyle(table); - const computedWidth = computedTableStyle.width; - if (computedWidth && computedWidth !== 'auto' && computedWidth !== '0px') { - const widthValue = parseFloat(computedWidth); - const widthUnit = computedWidth.replace(widthValue.toString(), '').trim(); - if (widthUnit !== '%') { - // Workaround for hardcoded table layout, closes #3205 - table.style.width = `calc(min(${computedWidth}, var(--available-width)))`; - } - } const parentWidth = window.getComputedStyle(parent as Element).width; const parentContainerWidth = parseFloat(parentWidth) || 0; if (totalTableWidth > 0) {