Fix column layout shift when inline editing (issue #2244)#2247
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #2244
PR #2241 fixed row-height shift by removing padding override, but the column widths still shifted because the table uses table-layout: auto — inserting an input element into a cell lets the browser re-distribute column widths based on the new content. Fix: snapshot each th's rendered offsetWidth and lock it as an inline style just before the inline editor is inserted (_freezeColumnWidths), then remove those temporary styles once editing ends (_unfreezeColumnWidths). Only headers without a manually-saved width are frozen, so user-resized columns are unaffected. Also add min-width: 0 to .inline-editor so the input's intrinsic size cannot push the column wider as a CSS-level guard. Fixes #2244
Solution summaryThe fix is implemented and pushed. Here's a summary of what was done: SummaryRoot cause: PR #2241 fixed row-height shift by removing padding overrides, but column widths still shifted because the table uses Fix — two-part:
PR: #2247 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.753013📊 Context and tokens usage:
Total: (70.3K + 4.1M cached) input tokens, 17.9K output tokens, $1.753013 cost 🤖 Models used:
📎 Log file uploaded as Gist (3406KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 5f71b98.
Problem
Despite PR #2241 fixing the row-height shift, the column widths still shift when editing a cell inline. The "Формула" column disappears and adjacent columns become wider while an editor is active (see issue screenshots).
Root Cause
PR #2241 removed the
paddingoverride that caused row-height growth, but the underlying cause of column reflow was not addressed:table-layout: auto(browser default), so column widths are determined by content<input>or<textarea>is inserted into a cell, the browser recalculates all column widths based on the new contentFix
JS (
js/integram-table/07-inline-edit.js):_freezeColumnWidths(): called just before the inline editor is inserted. Reads the current renderedoffsetWidthof eachthand locks it via inlinestyle.width/style.minWidth. Only freezes headers that don't already have a manually-saved width inthis.columnWidths, so user-resized columns are unaffected._unfreezeColumnWidths(): called when editing ends (save, cancel, or new-row cancel). Removes the temporary inline styles so the table returns to auto-layout.startInlineEdit,startNewRowFirstColumnEdit,saveInlineEdit,cancelInlineEdit,saveNewRowFirstColumn, andcancelNewRow.CSS (
css/integram-table.css):min-width: 0to.inline-editoras a CSS-level guard against the input's intrinsic size expanding the column width.How to reproduce
Testing
The freeze/unfreeze cycle is symmetric: every edit path (regular save, cancel, Tab navigation, new row) now correctly unfreezes on exit.
Fixes #2244