Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox onChange event only returns true or false #4134

Closed
rickysway opened this issue Sep 30, 2019 · 1 comment · Fixed by #8335
Closed

Checkbox onChange event only returns true or false #4134

rickysway opened this issue Sep 30, 2019 · 1 comment · Fixed by #8335
Labels
type: bug 🐛 version: 11 Issues pertaining to Carbon v11

Comments

@rickysway
Copy link

Issue
Checkbox onChange event only returns true|false (is missing event id and value) as indicated in the code
https://github.com/carbon-design-system/carbon-components-react/blob/master/src/components/Checkbox/Checkbox.js#L113

Recreate Issue
Using https://codesandbox.io/s/github/carbon-design-system/carbon/tree/master/packages/react/examples/codesandbox

  1. Update index.js
import React from "react";
import { render } from "react-dom";
import { Checkbox } from "carbon-components-react";

const App = () => (
  <div>
    <Checkbox
      labelText="Do you agree?"
      id="testID"
      onChange={event => {
        console.log(event)
      }}
    />
  </div>
);

render(<App />, document.getElementById("root"));
  1. Click the checkbox
  2. Click Console to see event only outputs true|false (no id returned)
@emyarod
Copy link
Member

emyarod commented Sep 30, 2019

based on https://github.com/carbon-design-system/carbon/blob/master/packages/react/src/components/Checkbox/Checkbox.js#L45 it looks like the event object should be returned as the 3rd parameter. we should change this to match the other change handlers in the codebase in the next major release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 version: 11 Issues pertaining to Carbon v11
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants