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.

[Checkbox][Radio] Option to disable hover effect for checkbox, switch, and radio

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate. (There was a somewhat related issue but I believe circumstances have since changed)

Summary 💡

My use case is a little tricky so I’d love some input on what you folks have seen and what would be most useful here.

In my case, I’m using the disableRipple option on MuiButtonBase in my theme. While upgrading to v4, we noticed that the checkbox, switch, and radio components now have a halo effect on hover. Normally this would fit right in, but when ripples are disabled, it feels out of place.

It’s only an issue with components whose hover is a halo rather than just a background change like buttons have.

The workaround is simple enough but I need to apply it to each component individually:

'&&:hover': {
  backgroundColor: 'transparent',
},

I saw that the effect uses theme.palette.action.hoverOpacity, but unfortunately that’s shared by more than just these components (for example, the hover effect for buttons).

The differentiating factor here is components that have a halo effect:

Screen Shot 2019-08-02 at 4 06 38 PM
  • Is it fair to treat these components differently?
  • Can this be a property on these specific components (disableHoverHalo?) or perhaps another theme value that affects only these components?
  • Could this be a property on ButtonBase that I would only use on these components?

Totally open to more ideas.

Thanks for your consideration!

Motivation 🔦

I have an acceptable workaround right now, but I’m always a fan of customizations that express intent rather than just override implementation - if the implementation were to change, perhaps in the next major version, this would be another item we’d have to track down and fix. However if this is another property on the component API, it’s more likely to be sustained between versions.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:25
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
faan234commented, Jul 15, 2021

Can I work on this?

1reaction
mnajdovacommented, Oct 26, 2022

People who set disableRipple to true might still want to keep the hover style, so I propose that we add a new property “disableHoverStyle” to the Radio component, which will skip default hover styles when is true.

I would propose using disableRipple for now, we don’t really have a use-case for this yet @VinceCYLiao In the end, it is anyway possible to do it with CSS override, so we are trying to add API for the most common use-cases. Feel free to pick this app and follow what’s done in the Checkbox component 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Checkbox][Radio] Option to disable hover effect for ...
It's only an issue with components whose hover is a halo rather than just a background change like buttons have. The workaround is...
Read more >
Checkboxradio
Checkboxradio. Enhances standard checkbox and radio input element to themeable buttons with appropriate hover and active styles. Examples.
Read more >
Checkbox/Radio how to color buttons - jquery
So I thought it would be simple then to just change the color codes used, but since there are three colors (hover-over, active,...
Read more >
JQuery Radio button
Handling Radio buttons using Jquery with enable disable and getting selected ... by adding effects , user interactions and styles by using Checkboxradio...
Read more >
jQuery UI Checkboxradio disable() Method
Checkboxradio Widget disable() method is used disable the checkboxradio button functionality. This method does not accept any parameters.
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