Skip to content

onClick is not being passed to all elements of the switch #125

Description

@Cenwulf

A switch component with onClick={(e) => e.stopPropagation()} attribute:

<Switch
  className="react-switch"
  onChange={this.handleChange}
  checked={this.state.checked}
  onClick={(e) => e.stopPropagation()}
/>

Nested in an accordion like component produces the following behaviour:
4d3525e33d

The onClick only appears to be passed to the background element of the component, clicking the circle element of the switch causes the click event to still be propagated to the switch's parent element even though stopPropagation() should be getting called for the entire switch component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions