Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rating): address inconsistent behavior in rating hover state #3185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-penguins-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@spectrum-css/rating": minor
---

Provides more granular control over the hover behavior of child stars within the rating component to prevent hovering in space adjacent to the component from highlighting all stars.
31 changes: 20 additions & 11 deletions components/rating/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,6 @@
cursor: default;
pointer-events: none;
}

/* When the entire component is hovered, show all solid icons */
&:hover {
.spectrum-Rating-starActive {
display: block;
}

.spectrum-Rating-starInactive {
display: none;
}
}
}

.spectrum-Rating-input {
Expand Down Expand Up @@ -168,6 +157,26 @@
display: block;
}
}

&:hover {
.spectrum-Rating-starActive {
display: block;
}

.spectrum-Rating-starInactive {
display: none;
}
}
}

.spectrum-Rating-icon:has(+ .spectrum-Rating-icon:hover) {
.spectrum-Rating-starActive {
display: block;
}

.spectrum-Rating-starInactive {
display: none;
}
}

.spectrum-Rating-starActive,
Expand Down
Loading