From 7322b931203cd3ba0a5557c96edfea079a440a6c Mon Sep 17 00:00:00 2001 From: Frank Tovar Date: Sat, 21 Mar 2026 11:30:37 +0100 Subject: [PATCH] Fix critical table shell height alignment --- src/RolemasterDb.App/wwwroot/tables.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/RolemasterDb.App/wwwroot/tables.js b/src/RolemasterDb.App/wwwroot/tables.js index 6db05a0..c13c5e7 100644 --- a/src/RolemasterDb.App/wwwroot/tables.js +++ b/src/RolemasterDb.App/wwwroot/tables.js @@ -3,19 +3,29 @@ window.rolemasterTables = window.rolemasterTables || { const tables = document.querySelectorAll(".critical-table"); for (const table of tables) { - for (const cell of table.querySelectorAll("td > .critical-cell")) { - cell.style.minHeight = ""; + for (const shell of table.querySelectorAll("td > .critical-table-cell-shell")) { + shell.style.minHeight = ""; + + const criticalCell = shell.querySelector(":scope > .critical-cell"); + if (criticalCell) { + criticalCell.style.minHeight = ""; + } } for (const row of table.tBodies) { for (const tr of row.rows) { for (const cell of tr.cells) { - const criticalCell = cell.querySelector(":scope > .critical-cell"); - if (!criticalCell) { + const shell = cell.querySelector(":scope > .critical-table-cell-shell"); + if (!shell) { continue; } - criticalCell.style.minHeight = `${cell.clientHeight}px`; + const computedStyle = window.getComputedStyle(cell); + const paddingTop = Number.parseFloat(computedStyle.paddingTop) || 0; + const paddingBottom = Number.parseFloat(computedStyle.paddingBottom) || 0; + const contentHeight = Math.max(0, cell.clientHeight - paddingTop - paddingBottom); + + shell.style.minHeight = `${contentHeight}px`; } } }