fix(weather): only reserve grid columns for enabled fields - #4290
Draft
ms-zone-41 wants to merge 1 commit into
Draft
ms-zone-41 wants to merge 1 commit into
ms-zone-41 wants to merge 1 commit into
Conversation
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.
ms-zone-41
force-pushed
the
fix/weather-grid-unused-columns
branch
from
October 3, 2026 10:29
1bda28a to
f793feb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Changes
forecast.njkandhourly.njkcount the enabled columns and pass the count in a--weather-columnscustom property.weather.cssuses this count for the number of grid tracks. If the property is not set (e.g. in a custom template fromthemeDir), it falls back to 7 tracks as before.inline-grid, so it follows the text alignment of its region again, like the former tables did.Screenshots
Default forecast and hourly view in
top_right. The orange outline shows the grid, the blue outline shows the region.Testing
npx vitest run tests/e2e/modules/weather_*(74 tests pass)node --run test:lintI used an AI coding assistant to help prepare this change. I reviewed and tested it myself.