Skip to content

[6.x] Fix the stars rating field rendering#14820

Open
jaygeorge wants to merge 7 commits into
forms-2from
star-rating-field-fixes
Open

[6.x] Fix the stars rating field rendering#14820
jaygeorge wants to merge 7 commits into
forms-2from
star-rating-field-fixes

Conversation

@jaygeorge

Copy link
Copy Markdown
Contributor

Description of the Problem

I noticed the star fills were not spaced correctly

What this PR Does

CSS

  • Fixes visual alignment, half-star rendering
    • Padding was asymmetric (padding-inline: 0 var(--_pad)); now symmetric (padding-inline: var(--_pad)) so thumb centers align with star slots
  • Fix mask geometry

Logic

  • Changed the min value to of the first selectable step to — 0.5 or 1 — not 0, which was needed to fix the rendering and padding maths — the range thumb position must correspond to star slot centers.

Behavioral note: A stored value of 0 still means “unrated”, but the slider visually sits at the first star position without showing fill.

So when there’s no rating:

Storage stays null / 0
Slider shows min (first star position) for alignment
CSS hides the fill via --unrated
The user never “selects 0 stars” — they either haven’t rated, or they’ve picked at least half a star.

How to Reproduce

  1. This is only noticeable on the frontend form rendering

@jaygeorge jaygeorge requested a review from duncanmcclean June 15, 2026 09:26
@jaygeorge jaygeorge changed the title Fix the stars rating field rendering [6.x] Fix the stars rating field rendering Jun 15, 2026
Comment thread resources/views/extend/forms/antlers/fields/star_rating.antlers.html Outdated
Comment thread resources/views/extend/forms/blade/fields/star_rating.blade.php Outdated
Comment thread resources/views/extend/forms/blade/fields/star_rating.blade.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to undo a lot of the refactoring from 7827322. What has actually changed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed 7827322 broke the way the stars worked with an input range, which meant the stars were mis-aligned on the frontend.

This is what Cursor said:

The computed value/min/unrated logic was brought back because the simplified version broke CSS thumb alignment and the unrated empty state. The inline style and inline @input from the refactor were kept. The substantive changes are min/step/unrated behaviour and CSS alignment fixes — not a return to the old architecture for its own sake.

I can try to bring it closer to your refactor…

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a more reasonable diff now—and the stars are working correctly on the rendered form

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.

2 participants