Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

🐛 Issues with Checkbox onClick event  #1027

@tjosepo

Description

Describe the bug

The Checkbox component has some odd behaviors when compared to <input type="checkbox" />, when reacting to a user input.

  • The onClick event is fired twice, once for the label, then for the underlying input element.
  • The event.target.value of the checkbox is always set to "on", even when a value prop is specified.

These issues make working with the onClick event difficult.

Steps to reproduce

<Checkbox
 value="custom value"
 onClick={(e) => {
  console.log(e.target);
  console.log(e.target.value)
}}>
  Milky Way
</Checkbox>

Expected results

  • Only one onClick event fired, targetting the input DOM element.
  • event.target.value is equal to the value prop of the Checkbox element.

Reproducible demo

You can copy/paste the code from this issue in the Orbit Storybook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions