Skip to content

input type=checkbox cannot be a controlled component? #2714

Open
@mischnic

Description

@mischnic

Reproduction

With this example, React creates a controlled input while Preact creates a uncontrolled input.

import React from "preact/compat";

function App() {
	return <input type="checkbox" checked={true} />;
}

In fact, I can't figure out how to make a controlled checkbox at all.

Not sure if this is a duplicate of #2625 or #1899

Steps to reproduce

https://codesandbox.io/s/preact-input-uncontrolled-qis0i

Click on the checkbox

Expected Behavior

Clicking on the checkbox shouldn't change its state (= what React does).

Actual Behavior

The checkbox can be toggled. checked={true} is essentially ignored.

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