{"action":"closed","issue":{"url":"https://api.github.com/repos/material-components/material-components-web/issues/4018","repository_url":"https://api.github.com/repos/material-components/material-components-web","labels_url":"https://api.github.com/repos/material-components/material-components-web/issues/4018/labels{/name}","comments_url":"https://api.github.com/repos/material-components/material-components-web/issues/4018/comments","events_url":"https://api.github.com/repos/material-components/material-components-web/issues/4018/events","html_url":"https://github.com/material-components/material-components-web/issues/4018","id":375604774,"node_id":"MDU6SXNzdWUzNzU2MDQ3NzQ=","number":4018,"title":"Patching native getters and setters for Checkbox causes React to misfire events.","user":{"login":"jamesmfriedman","id":975256,"node_id":"MDQ6VXNlcjk3NTI1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/975256?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesmfriedman","html_url":"https://github.com/jamesmfriedman","followers_url":"https://api.github.com/users/jamesmfriedman/followers","following_url":"https://api.github.com/users/jamesmfriedman/following{/other_user}","gists_url":"https://api.github.com/users/jamesmfriedman/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmfriedman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmfriedman/subscriptions","organizations_url":"https://api.github.com/users/jamesmfriedman/orgs","repos_url":"https://api.github.com/users/jamesmfriedman/repos","events_url":"https://api.github.com/users/jamesmfriedman/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmfriedman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-10-30T17:21:26Z","updated_at":"2018-11-01T19:32:54Z","closed_at":"2018-11-01T19:32:54Z","author_association":"CONTRIBUTOR","body":"I'll try to keep my bedside manner, but this just killed half my day.\r\n\r\nhttps://github.com/material-components/material-components-web/blob/2645aa4f43ae2ac10fa2acb904bfa1362657f378/packages/mdc-checkbox/foundation.js#L143\r\n\r\nI'll do my best to explain the issue as it relates to React and RMWC. https://github.com/jamesmfriedman/rmwc/issues/312\r\n\r\n- Somewhere deep in React's synthetic event system, it binds to onChange handlers. Don't ask me where it is, but it exists. I've seen the code. It pools them all at the document body (soon to be the React root)\r\n- In what appears to be an attempt to fire the event animations deterministically, MDC has hijacked the setter and getter for the checkbox properties. I'm sure this has worked fine for Vanilla Web\r\n- In React, after a programmatic update, React loses the ability to fire an onChange event on said checkbox.\r\n- I used to wrap the vanilla js component in React. This issue came up, but it was resolved by fudging the event cycle with a RAF.\r\n- Since 3.0, I've moved to doing the foundation integration the \"right\" way which is where this issue has come back to rear its ugly head and has not been fixable by any sort of scotch tape.\r\n- As a last ditch effort, I've monkey patched MDCFoundation prototype and made `installPropertyChangeHooks_` and empty function which is the source of the evil. https://github.com/jamesmfriedman/rmwc/commit/3ffef39d527ce153821ee6595299e0a24650ab9c\r\n- I still have animations on both controlled and uncontrolled checkboxes because I'm forcing my own internal `sync` method to be called on the native `change` event which in turn calls foundation.handleChange_() which calls transitionCheckState anyways which is what it looks like you were trying to do.\r\n- Ahhhhh!\r\n\r\nSo why the heck not just listen to the change event?"}}
{"actor":{"display_login":"kfranqueiro"}}