Skip to content

defaultChecked prop sets only checked attribute #12765

@klintmane

Description

@klintmane

Type

inconsistency for common use cases.
bug for projects relying on correct DOM emissions.

Description

It's unclear to me if the following is a known issue or not.
Take in consideration the snippet below:

<input type="checkbox" defaultChecked={true} />

Current Behavior

Setting the defaultValue prop on inputs of other types sets both the value and defaultValue attribute on the DOM element.

When setting the defaultChecked prop on inputs of type checkbox only the checked attribute is correctly set, leaving the defaultChecked attribute unchanged.

Expected Behaviour

Like mentioned above, the expected behavior would be for the defaultChecked prop to set both the checked and defaultChecked attributes on the corresponding DOM node (like it's the case with the defaultValue prop).

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