Skip to content

onChange behaviour on radio buttons in 15.6.2 #12172

Closed
@saenglert

Description

@saenglert

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
When assigning the onChange listener on a radio button group (or its form) the event only fires once per radio button

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
I created a basic example of the problem (which is working in jsfiddle since I guess its using the most up to date version of react)
https://jsfiddle.net/6vco4t1h/1/
I also found a workaround for the problem by using a components internal state detailed here:
https://jsfiddle.net/6vco4t1h/

What is the expected behavior?
The onChange event should fire every time the selected radio button changes

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Affected version is 15.6.2 and as far as I can tell it happens across all browsers. I did not check previous but future versions and in 16.x this problem appears to be fixed (sadly we are still in in the process of preparing for the update to 16.x).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions