question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Rating] Component hover state gets stuck

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Multiple Star components are rendered on-screen. Hovering without clicking seems to make some of them stay highlighted.

Expected Behavior 🤔

Should not be filled in unless clicked.

Steps to Reproduce 🕹


<DialogContent>
                  {ScoreNames.map((name, idx) => {
                    return (
                      <div key={idx}>
                        <div
                          className={clsx(classes.scoreName, {
                            [classes.validationError]:
                            submitCount > 0 && errors[name]
                          })}
                        >
                          {t("score-" + name)}
                        </div>
                        <StyledRating
                          name={name}
                          value={parseInt(values[name])}
                          onChange={handleChange}
                          disabled={isSubmitting}
                          size={"medium"}
                          max={10}
                          emptyIcon={<StarBorderIcon fontSize="inherit"/>}
                        />
                      </div>
                    );
                  })}

Context 🔦

Just trying to give people a way to leave ratings…

Your Environment 🌎

I’m using them in a dialog.

ezgif com-video-to-gif (2)

Tech Version
Material-UI v4.8.0
Material-labs v4.0.0 alpha 36
React v16.12.0
Browser chrome
TypeScript nope
etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fyodore82commented, Dec 30, 2019

I’ll do the pull request

0reactions
oliviertassinaricommented, Dec 27, 2019

Hum, I wonder if we don’t have a performance issue that originates on this problem, however, the pointer event proposal seems to fix the problem 😃.

diff --git a/packages/material-ui-lab/src/Rating/Rating.js b/packages/material-ui-lab/src/Rating/Rating.js
index d454c2481e..a5108473f6 100644
--- a/packages/material-ui-lab/src/Rating/Rating.js
+++ b/packages/material-ui-lab/src/Rating/Rating.js
@@ -92,6 +92,9 @@ export const styles = theme => ({
     transition: theme.transitions.create('transform', {
       duration: theme.transitions.duration.shortest,
     }),
+    // Fix mouseLeave issue.
+    // https://github.com/facebook/react/issues/4492
+    pointerEvents: 'none',
   },
   /* Styles applied to the icon wrapping elements when empty. */
   iconEmpty: {

Does anyone want to work on a pull request? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Rating] Component hover state gets stuck #18939 - GitHub
Multiple Star components are rendered on-screen. Hovering without clicking seems to make some of them stay highlighted. Expected Behavior.
Read more >
XD Hover state not working - Adobe Support Community
Solved: Hey guys, I'm currently prototyping an app and i've been creating hover state for buttons and most a working but there is...
Read more >
Solving Sticky Hover States with @media (hover - CSS-Tricks
The solution, or trick, is a new(ish) “CSS4” media query that allows you only to apply styles on devices with hover capability. Your...
Read more >
submit button stays hover color after clicked - Stack Overflow
The active state is only triggered when the element is being clicked. Here is what I did .buttons input:focus { outline: none }...
Read more >
"Default elementor button is stuck on hover "grow" - Reddit
Hi! Did anybody encounter the "Default elementor button is stuck on hover "grow""-issue? Happens on a Hello Theme Woocommerce site.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found