This skill should be used when debugging visual CSS and layout issues in the tweakpane-table plugin, specifically for investigating column alignment problems between table headers and data rows.
Debug visual CSS and layout issues in the tweakpane-table plugin using Playwright browser automation. Measure actual element dimensions, compare DOM structures, inspect CSS properties, and identify root causes of alignment problems between table headers and data cells.
Use this skill in these scenarios:
Open the local test HTML file in the Playwright browser.
Available test files:
test/simple.html - Basic 2-column table (Text, List)test/advanced.html - Complex 5-column table (Name, Type, Link, Trigger, Delete)Navigate using absolute path:
Use mcp__playwright__browser_navigate
Construct the absolute path from the working directory (/data/Workspace/helios/tweakpane-table):
file:///data/Workspace/helios/tweakpane-table/test/simple.html
After navigation, capture both accessibility and visual information:
Take accessibility snapshot:
Use mcp__playwright__browser_snapshot
This provides the DOM structure in a text format.
Take visual screenshot:
Use mcp__playwright__browser_take_screenshot
Set fullPage: false for viewport screenshot, or fullPage: true for entire page.
Save as: alignment-issue-{timestamp}.png
Run the comprehensive measurement script to get precise dimensions and CSS properties.
Execute measure_table.js:
Use mcp__playwright__browser_evaluate
function: Read scripts/measure_table.js file content and pass as the function parameter
Script returns:
Analyze the results for:
Run the structure comparison script to identify hierarchy differences.
Execute compare_structure.js:
Use mcp__playwright__browser_evaluate
function: Read scripts/compare_structure.js file content and pass as the function parameter
Script returns:
Look for:
If measurement scripts reveal issues, inspect specific elements interactively.
Check inline styles:
() => {
const headerCell = document.querySelector('.tp-headv .tp-lblv');
const rowCell = document.querySelector('.tp-rowv .tp-lblv');
return {
header: {
inlineWidth: headerCell.style.width,
inlineFlex: headerCell.style.flex,
allInlineStyles: headerCell.style.cssText
},
row: {
inlineWidth: rowCell.style.width,
inlineFlex: rowCell.style.flex,
allInlineStyles: rowCell.style.cssText
}
};
}
Check computed styles:
() => {
const headerCell = document.querySelector('.tp-headv .tp-lblv');
const rowCell = document.querySelector('.tp-rowv .tp-lblv');
const hcs = window.getComputedStyle(headerCell);
const rcs = window.getComputedStyle(rowCell);
return {
header: {
width: hcs.width,
flex: hcs.flex,
flexBasis: hcs.flexBasis,
flexGrow: hcs.flexGrow,
flexShrink: hcs.flexShrink,
minWidth: hcs.minWidth,
maxWidth: hcs.maxWidth,
padding: hcs.padding,
boxSizing: hcs.boxSizing
},
row: {
width: rcs.width,
flex: rcs.flex,
flexBasis: rcs.flexBasis,
flexGrow: rcs.flexGrow,
flexShrink: rcs.flexShrink,
minWidth: rcs.minWidth,
maxWidth: rcs.maxWidth,
padding: rcs.padding,
boxSizing: rcs.boxSizing
}
};
}
Based on measurements and comparisons, identify the root cause:
Common issues to check:
Width not applied
width or flex exists on cells.tp-lblv not .tp-lblv_v)Flex properties overriding width
flex: 1 on child .tp-lblv_v causes expansionflex-grow: 0 and flex-shrink: 0 are setflex: 0 0 {width} not just widthStructural differences
Padding/margin differences
Label visibility
For deeper understanding, read the reference documentation:
Tweakpane DOM structure:
Read references/tweakpane-dom-structure.md
Explains:
.tp-lblv, .tp-brkv, .tp-rotv)flex is needed instead of widthCommon alignment issues:
Read references/common-alignment-issues.md
Catalogs known issues:
Structure the debugging report:
## Visual Alignment Issue Analysis
### 1. Visual Evidence
[Screenshot showing the alignment issue]
### 2. Measurements
[Table showing header vs row widths for each column]
Column | Header Width | Row Width | Difference | Aligned?
-------|-------------|-----------|------------|----------
0 | 123.5px | 98.2px | 25.3px | ❌
1 | 245.0px | 245.0px | 0px | ✅
### 3. Root Cause
[Explanation of what's wrong]
Example: "Width is being set as inline `width` property, but the child `.tp-lblv_v` element has `flex: 1` which causes it to expand beyond the parent's width constraint."
### 4. CSS/DOM Differences
[List of specific differences between headers and rows]
### 5. Recommended Fix
[Specific code changes with file names and line numbers]
Example:
```javascript
// In src/head.ts line 126:
// Change from:
api.element.style.width = headerParams.width;
// To:
api.element.style.flex = `0 0 ${headerParams.width}`;
[How to verify the fix works]
## Key Files Reference
When implementing fixes, check these files:
- `src/sass/plugin.scss` - CSS styles for table layout
- `src/head.ts` - Header implementation (line ~126: width application)
- `src/row.ts` - Row implementation (line ~112: RowPane.addBinding width application)
- `test/simple.html` - Basic test case
- `test/advanced.html` - Complex test case
## Testing After Fixes
1. Apply the recommended fix
2. Rebuild the plugin: `npm run build:dev`
3. Reload the test page in browser (hard refresh: Ctrl+Shift+R)
4. Re-run measurement scripts to verify alignment
5. Test both simple.html and advanced.html
6. Take new screenshots to confirm fix
## Resources
### scripts/
**measure_table.js** - Comprehensive measurement script that:
- Measures all header and row cell dimensions
- Captures CSS properties (computed and inline)
- Calculates alignment differences automatically
- Returns structured data for analysis
**compare_structure.js** - DOM structure comparison script that:
- Builds hierarchical tree of elements
- Compares header vs row structure
- Identifies tag/class/CSS mismatches
- Reports differences at each nesting level
### references/
**tweakpane-dom-structure.md** - Complete reference for:
- Tweakpane v4 DOM structure
- Core classes and their purposes
- Tweakpane-table plugin structure
- Width application requirements
- Common CSS rules
**common-alignment-issues.md** - Catalog of known issues:
- Issue symptoms and root causes
- Diagnostic procedures
- Solutions with code examples
- Prevention checklist