Skip to content

feat(weather): enable CSS ordering for forecast and hourly columns - #4118

Merged
khassel merged 6 commits into
MagicMirrorOrg:developfrom
MannXo:fix/4117-weather-forecast-column-order
Sep 12, 2026
Merged

khassel merged 6 commits into
MagicMirrorOrg:developfrom
MannXo:fix/4117-weather-forecast-column-order

Conversation

@MannXo

@MannXo MannXo commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

The daily forecast previously displayed its columns in a fixed order that did not match the order requested in the issue.

This PR makes the forecast column order configurable through CSS custom properties. The default order is now:

condition, min temp (low), max temp (high), UV Index, precipitation amount, precipitation probability

The hourly forecast is updated to use the same approach, with its own configurable column order.

Fixes #4117

forecast before

Ekrankopio de 2026-09-12 23-48-38 image

forecast after

Ekrankopio de 2026-09-12 23-47-47 image

hourly before

Ekrankopio de 2026-09-12 23-49-12

hourly after

Ekrankopio de 2026-09-12 23-49-28

Note: The PR was updated based on reviews, and the PR text was updated accordingly.

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

Thanks for the PR! Can you attach a before and after screenshot?

@rejas

rejas commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

I am not sure if changing the order is a good idea. Our users are used to how this is ordered now, changing it might confuse some...

But I am willing to see the change in screenshots, before making up my mind finally...

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@MannXo Did you noticed the request for screenshots? 🙂

@MannXo

MannXo commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

@KristjanESPERANTO thank you for the reminder.
the before after screenshots are attached.
after
before

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@MannXo Thanks for the screenshots 🙂 Please mark which is which. I think the first is the "after" one, right?

@MannXo

MannXo commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@KristjanESPERANTO indeed.
First one is the "after" and second one is "before"

@KristjanESPERANTO
KristjanESPERANTO requested a review from rejas May 6, 2026 07:18
@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@rejas What do you think?

@rejas

rejas commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Sorry for my late answer... Thanks fro your PR. I could see something like this merged, IF we could make the order configurable. So that people could arrange them to their likings. Maybe using a flex order css property would be the solution (so people could change that order via custom css)
@MannXo are you comfortable trying something like this out? Or how good are your css skills?

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@MannXo Did you noticed the last comment? 🙂

@MannXo

MannXo commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@KristjanESPERANTO I feel I can do that. shall I create an issue for it first? or shall I just revert my commits on this branch and implement the flex?

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

I think it would be best to do it in this PR here. When we merge, we'll squash all the commits into one, so you don't have to worry too much about keeping the Git history clean 🙂

@MannXo

MannXo commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

@rejas @KristjanESPERANTO
I updated this PR to make the forecast column order configurable via CSS.

The forecast table now has a weather-forecast class, and each forecast cell has a default order value backed by CSS variables, so users can override the visual order from custom.css without changing the module template.
I also added an e2e assertion for the CSS order hooks.

example:

.weather .weather-forecast {
  --weather-forecast-min-temp-order: 4;
  --weather-forecast-max-temp-order: 3;
}

@KristjanESPERANTO

KristjanESPERANTO commented Jun 15, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for the updated approach 👏

Two concerns though:

  1. display: flex on <tr>
    order is only defined for flex/grid items, so applying flex to a table row to make it work feels a bit hacky. Since the table has no <th> headers anyway, a <div>-based flex layout might be the cleaner path forward.

  2. Order-dependent padding
    min-temp loses padding-left, max-temp gains it. That works for the new default, but breaks as soon as someone actually swaps the order via the CSS variables. Padding should be independent of position.

What do you think?

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@MannXo Did you noticed my comment? 🙂

@KristjanESPERANTO KristjanESPERANTO self-assigned this Sep 12, 2026
@KristjanESPERANTO
KristjanESPERANTO force-pushed the fix/4117-weather-forecast-column-order branch from 1e4c168 to 4c0a3a5 Compare September 12, 2026 21:42
@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

Okay, I decided to take this on myself since there hasn’t been any response from @MannXo so far.

Migrating the forecast layout to CSS Grid was a bit tricky, but I think the result is now clean and stable. For consistency, I adapted the hourly view as well.

I added screenshots into the PR text.

While checking the current view, I noticed that an incorrect <td> element was being used, so I replaced it with a proper <div>. That is a bit out of scope, but too small for a separate PR.

@KristjanESPERANTO KristjanESPERANTO changed the title fix(weather): reorder daily forecast columns feat(weather): enable CSS ordering for forecast and hourly columns Sep 12, 2026
@khassel
khassel merged commit 3314eaf into MagicMirrorOrg:develop Sep 12, 2026
13 checks passed
@KristjanESPERANTO KristjanESPERANTO mentioned this pull request Oct 1, 2026
KristjanESPERANTO added a commit that referenced this pull request Oct 1, 2026
## Release Notes
Thanks to: @ago1776, @alkank, @Antra, @Blackspirits, @deBasMan21,
@flightlesstux, @i-xul, @jamalkamaladdin, @khassel, @KristjanESPERANTO,
@MannXo, @pascalpfammatter, @rejas
> ⚠️ This release needs nodejs version >=22.22.2 <23 || >=24

[Compare to previous Release
v2.37.0](v2.37.0...develop)


### [core]
- Prepare Release 2.38.0 (#4285)
- fix: let Electron select the Wayland display (#4268)
- fix(http): improve access error messages (#4281)
- fix: always redact client configuration (#4275)
- refactor: migrate browser scripts to ESM (#4272)
- refactor: convert animateCSS to ES module (#4266)
- use filter instead of find to get all allowed secrets when multiple
instances of a module are active (#4265)
- refactor: convert notificationFx to ES module (#4263)
- refactor: enforce function expression style (#4262)
- fix: validate client IP behind trusted proxies (#4261)
- prefer arrow over function (#4252)
- refactor(utils): simplify configuration validation and error handling
(#4240)
- fix(server): validate request origins (#4234)
- remove codeql warning (#4231)
- refactor(socket): use direct ESM import in main (#4225)
- refactor(socket): load Socket.IO client via ESM (#4224)
- style: simplify Electron startup checks (#4213)
- refactor: consolidate electron bootstrap into async function (#4210)
- refactor(module): simplify and fix configMerge (#4203)
- refactor: convert Translator to ES module (#4202)
- docs: add CodeQL review steps and restructure after-release checklist
(#4200)
- refactor: centralize server port resolution (#4198)
- refactor: use const instead of let for variable declarations (#4196)
- refactor: replace Loader object with named exports (#4195)
- set next release dev number
- refactor(eslint): enforce prefer-arrow-callback rule (#4251)
- refactor(http_fetcher): make dynamic URL handling explicit (#4282)
- refactor: use explicit global config (#4233)
- expand logic of hideConfigSecrets, add more tests (#4229)
- refactor: make browser startup more explicit (#4214)

### [dependencies]
- update dependencies (#4276)
- update dependencies incl. electron to v44 (#4250)
- chore: update eslint incl. plugins + review rules (#4236)
- Bump actions/stale from 10 to 11 (#4215)
- update dependencies (#4221)
- Bump actions/setup-node from 6 to 7 (#4204)
- chore: update dependencies (#4201)
- Bump electron from 42.5.2 to 43.0.0 (#4192)

### [modules/alert]
- Move alert translations into common translations (#4284)

### [modules/calendar]
- Fixes issue 4243: Ensure while loop in calendar module does not get
stuck when no entries (#4244)
- fix(calendar): escape HTML in event title and location (#4260)
- calendar: allow custom events to override symbol class (#4257)
- Fix calendar crash when yearmatchgroup regex does not match (#4239)
- fix(calendar): keep yearly events in DTSTART's month when BYMONTH is
missing (#4222)
- fix(calendar): correct multi-day slice day counts (#4232)
- chore: update dependencies + adapt calendar tests (#4211)
- fix(calendar): sliced multi-day events start at 00:00, not 23:59
(#4208)

### [modules/newsfeed]
- newsfeed: don't use cors url in njk template (#4279)
- refactor(newsfeed): extract feed item normalization into feeditem.js
(#4271)
- refactor(newsfeed): replace feedme lib with feedparser (#4269)
- newsfeed: fix allowedBasicHtmlTags (#4258)
- newsfeed: update checkArticleUrl (#4256)

### [modules/updatenotification]
- feat(updatenotification): implement trusted module configuration for
update commands (#4259)

### [modules/weather]
- feat: add FMI weather provider (#4278)
- feat(weather): enable CSS ordering for forecast and hourly columns
(#4118)
- fix(weather): respect initial load delay (#4254)
- fix(weather): restrict provider loading to the providers directory
(#4235)
- refactor(weather): extract WeatherProvider base class (#4228)

### [testing]
- ci: fail lint on warnings (#4230)
- add test if install works for minimal node version (#4197)

### [translation]
- feat(i18n): add Azerbaijani translation (#4283)
- feat(i18n): complete Turkish translations (#4277)
- Improve Portuguese translations (#4274)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kevin G. <[email protected]>
Co-authored-by: veeck <[email protected]>
Co-authored-by: Veeck <[email protected]>
Co-authored-by: Karsten Hassel <[email protected]>
Co-authored-by: Jboucly <[email protected]>
Co-authored-by: Jboucly <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarno <[email protected]>
Co-authored-by: sam detweiler <[email protected]>
Co-authored-by: Jordan Welch <[email protected]>
Co-authored-by: Blackspirits <[email protected]>
Co-authored-by: Samed Ozdemir <[email protected]>
Co-authored-by: in-voker <[email protected]>
Co-authored-by: Andrés Vanegas Jiménez <[email protected]>
Co-authored-by: cgillinger <[email protected]>
Co-authored-by: Sonny B <[email protected]>
Co-authored-by: sonnyb9 <[email protected]>
Co-authored-by: Morgan McBee <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Mike Bishop <[email protected]>
Co-authored-by: ago1776 <[email protected]>
Co-authored-by: pascalpfammatter <[email protected]>
Co-authored-by: Pascal Pfammatter <[email protected]>
Co-authored-by: Anders Demant van der Weide <[email protected]>
Co-authored-by: Bas Buijsen <[email protected]>
Co-authored-by: Parman Mohammadalizadeh <[email protected]>
Co-authored-by: alkank <[email protected]>
Co-authored-by: Henkka <[email protected]>
Co-authored-by: Ercan Ermis <[email protected]>
Co-authored-by: Jamal Kamaladdinoglu <[email protected]>
ms-zone-41 added a commit to ms-zone-41/MagicMirror that referenced this pull request Oct 3, 2026
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.

4 participants