Skip to content

fix(weather): only reserve grid columns for enabled fields - #4290

Draft
ms-zone-41 wants to merge 1 commit into
MagicMirrorOrg:developfrom
ms-zone-41:fix/weather-grid-unused-columns
Draft

ms-zone-41 wants to merge 1 commit into
MagicMirrorOrg:developfrom
ms-zone-41:fix/weather-grid-unused-columns

Conversation

@ms-zone-41

@ms-zone-41 ms-zone-41 commented Oct 3, 2026 •

Copy link
Copy Markdown

Since the forecast and hourly views switched to CSS grid in #4118, they always define seven column tracks and are rendered as a block-level grid. This causes two layout problems:

  • The tracks of disabled fields are empty, but the rows (subgrids) still add half of their 25px column gap after the last visible column. So every view ends with 12.5px of blank space and is not flush with the right edge in the right regions.
  • A view that is narrower than its region (e.g. the hourly view below a wider forecast) ignores the text alignment of the region and sticks to the left edge, also in the right and centered regions.

Changes

  • forecast.njk and hourly.njk count the enabled columns and pass the count in a --weather-columns custom property.
  • weather.css uses this count for the number of grid tracks. If the property is not set (e.g. in a custom template from themeDir), it falls back to 7 tracks as before.
  • The grid is now rendered as inline-grid, so it follows the text alignment of its region again, like the former tables did.
  • E2E tests check that no space is reserved after the last visible column. Both tests fail without the fix.

Screenshots

Default forecast and hourly view in top_right. The orange outline shows the grid, the blue outline shows the region.

develop this PR
develop this PR

Testing

  • npx vitest run tests/e2e/modules/weather_* (74 tests pass)
  • node --run test:lint

I used an AI coding assistant to help prepare this change. I reviewed and tested it myself.

Since the switch to CSS grid (MagicMirrorOrg#4118) the forecast and hourly views always
define seven column tracks and are rendered as a block-level grid:

- The tracks of disabled fields are empty, but the rows (subgrids) still
  add half of their 25px column gap after the last visible column. So
  every view ends with 12.5px of blank space and is not flush with the
  right edge in the right regions.
- A view that is narrower than its region (e.g. the hourly view below a
  wider forecast) ignores the text alignment of the region and sticks
  to the left edge, also in the right and centered regions.

The templates now pass the number of enabled columns in a
--weather-columns custom property, which the grid uses for its track
count (falling back to 7 for custom templates). The grid is rendered
inline so it again follows the region's text alignment, like the former
tables did.
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.

1 participant