You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
good first issueGreat for first contributions. Enable to learn the contribution process.scope: switchChanges related to the switch.type: bugIt doesn't behave as expected.
Looks like a small change. If no one is working on it, then I can do it. This will be my first contribution.
As far as my understanding, when you pass
onClick={(event)=>{event.preventDefault();}}
the state will change from checked to uncheck, but we don't want that right?
Now that I look at this issue without Material-UI: This looks like a React bug to me. We should still get this fix in but I'm also opening a React issue to get some clarification.
Hello @joshuambg@oliviertassinari , I am looking to work on the issue as a first time with open source. Is it taken already? If not I'll like to contribute
Hi @oliviertassinari . Seems to me that issue is still present. From
<IconButton onClick={(event) => {event.preventDefault()}} onChange={(e) => {e.preventDefault()}}>
wont stop rerender.
@oliviertassinari yes. Just updated with latest release and error still appears.
It seems to have problem with: <IconButton onClick={myAccountHandle}> <AccountCircleIcon/> </IconButton>
good first issueGreat for first contributions. Enable to learn the contribution process.scope: switchChanges related to the switch.type: bugIt doesn't behave as expected.
Activity
eps1lon commentedon Nov 25, 2020
Below the [Switch API props table] you'll find
which means that you're not preventing the default behavior of the click event on
<input />but<IconButton />.However, it doesn't seem like you can do this at the moment. Passing
onClicktoinputPropsworks only after the first state change: https://codesandbox.io/s/switch-click-prevent-default-tutkj[-]No way to prevent Switch from updating on click[/-][+][Switch] preventDefault is ignored[/+]oliviertassinari commentedon Nov 25, 2020
Should we solve the issue like this?
satyadeeproat commentedon Nov 29, 2020
Looks like a small change. If no one is working on it, then I can do it. This will be my first contribution.
As far as my understanding, when you pass
onClick={(event)=>{event.preventDefault();}}
the state will change from checked to uncheck, but we don't want that right?
oliviertassinari commentedon Nov 29, 2020
@satyadeeproat this sounds accurate. The objective is to reproduce the behavior of a native input checkbox. We will need to add a test case for it.
satyadeeproat commentedon Nov 29, 2020
Ok. let me do it. Will add a test case too.
eps1lon commentedon Nov 30, 2020
Now that I look at this issue without Material-UI: This looks like a React bug to me. We should still get this fix in but I'm also opening a React issue to get some clarification.
Edit: Already reported: react/react#9023
marianayap commentedon Nov 30, 2020
Hello @joshuambg @oliviertassinari , I am looking to work on the issue as a first time with open source. Is it taken already? If not I'll like to contribute
oliviertassinari commentedon Nov 30, 2020
@marianayap Sorry, the issue was already worked on. The problem should now have been solved :)
Wakabanan commentedon Dec 23, 2020
Hi @oliviertassinari . Seems to me that issue is still present. From
<IconButton onClick={(event) => {event.preventDefault()}} onChange={(e) => {e.preventDefault()}}>
wont stop rerender.
oliviertassinari commentedon Dec 24, 2020
@laik97 do you have a reproduction with v5.0.0-alpha.20?
Wakabanan commentedon Dec 28, 2020
@oliviertassinari yes. Just updated with latest release and error still appears.
It seems to have problem with:
<IconButton onClick={myAccountHandle}> <AccountCircleIcon/> </IconButton>