Design comparison
Solution retrospective
Hi, PLease help in this-> The focus and active psuedo class is working only after double clicking the rating button. but it should work on single click.
If I add "pointer-events: none;" to the button tag then the focus and active classes works fine but then react onClick event is not working. What shouldI do?
Community feedback
- @JoyGHubPosted over 2 years ago
Hello Saniya!
The star in the circle above, and the numbers inside the rating buttons don't seem to be centered perfectly. Also, I wouldn't let the user submit without selecting a rating first.
Other than that, the component looks excellent!
Keep it up,
- Stefan RIZEA
Marked as helpful0@saniyasaher20Posted over 2 years ago@JoyGHub thanks, You're right, form shouldn't submit without rating. I will add that validation.
0 - @DavidMorgadePosted over 2 years ago
The css :hover and :active can get buggy if they are used in the same element, try getting out of the active status and identify the clicked button using useState hook instead, you can use a function for each clicked button example:
const [isActive, setIsActive] = useState(false);
const handleClick = event => { setIsActive(current => !current); };
Hope it helps!
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord