Skip to content

fix: footer margin handling (Closes #6616 )#6618

Open
ninix07 wants to merge 1 commit into
Textualize:mainfrom
ninix07:nn/fix/footer-margin
Open

fix: footer margin handling (Closes #6616 )#6618
ninix07 wants to merge 1 commit into
Textualize:mainfrom
ninix07:nn/fix/footer-margin

Conversation

@ninix07

@ninix07 ninix07 commented Jul 1, 2026

Copy link
Copy Markdown

Description

This PR resolves the issue where setting a margin on a docked Footer would not shrink the footer correctly on both sides, causing the right margin to clip off-screen.

Root Cause

The Footer widget inherits from ScrollableContainer, which defaults to width: 1fr;. For docked widgets, the layout resolver evaluates fractional widths (1fr) relative to the full container size (e.g. 120 cells) without subtracting the margins. It then adds the margins on top of this width (e.g. 120 + 10 = 130 cells), which causes the widget to exceed the screen width and clip the right margin off-screen when translated by the left margin.

Solution

Adding width: 100%; to the Footer widget's DEFAULT_CSS overrides the inherited 1fr. Percentage-based widths in the box model resolver are calculated relative to the container width minus the margins. This allows the footer to resolve to the correct size (110 cells) and shrink properly to respect both the left and right margins (matching how Header works).


Testing

  • New Snapshot Test App: Created tests/snapshot_tests/snapshot_apps/footer_margin.py to render the Footer with a margin of 5 on all sides over a blue background.
  • Test Case: Added test_footer_margin to tests/snapshot_tests/test_snapshots.py and generated the baseline SVG (test_footer_margin.svg).

Related Issues
Closes #6616


This Pull Request was generated with the assistance of Windsurf, an AI-powered code editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Footer style margin right not working

1 participant