Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox komisches Verhalten #7394

Open
laske185 opened this issue Feb 19, 2025 · 3 comments
Open

Checkbox komisches Verhalten #7394

laske185 opened this issue Feb 19, 2025 · 3 comments
Assignees
Labels
doc Improvements or additions to documentation v2 v3 Here are issues that need to be resolved for version 3.

Comments

@laske185
Copy link
Contributor

laske185 commented Feb 19, 2025

Klickt man auf die Checkbox muss man immer zweimal Klicken bis sie den Wert ändert.

  1. Unchecked: Image

  2. Checked: Image

  3. Checked: Image

  4. Unchecked: Image

const [checked, setChecked] = useState<boolean>(false);

	return (
		<>
			<KolInputCheckbox _checked={checked} _label="test" _on={{ onInput: (e, v) => setChecked(!v) }} />
		</>
	);

"@public-ui/components": "2.2.3",

@deleonio deleonio added v2 v3 Here are issues that need to be resolved for version 3. labels Feb 19, 2025
@deleonio deleonio moved this to 🗂️ Backlog in KoliBri Board Feb 19, 2025
@sdvg sdvg self-assigned this Feb 19, 2025
@sdvg sdvg moved this from 🗂️ Backlog to 🏗 In progress in KoliBri Board Feb 19, 2025
@sdvg
Copy link
Member

sdvg commented Feb 19, 2025

Ich glaube der Fehler liegt hier im Beispiel:

const [checked, setChecked] = useState<boolean>(false);

return (
    <>
-        <KolInputCheckbox _checked={checked} _label="test" _on={{ onInput: (e, v) => setChecked(!v) }} />
+        <KolInputCheckbox _checked={checked} _label="test" _on={{ onInput: (e, v) => setChecked(v) }} />
    </>
);

So wäre es korrekt. Als value (v) wird immer der neue Value bzw. State übergeben. Wird er negiert, ist der State entsprechend falsch.

@laske185 Bitte um Bestätigung. Habe ich hier einen Denkfehler?

@sdvg sdvg changed the title Checkbox komischese Verhalten Checkbox komisches Verhalten Feb 19, 2025
@laske185
Copy link
Contributor Author

Wichtig ist die Unterscheidung zwischen checked und value!
Ein verbessertes Beispiel: https://stackblitz.com/edit/vitejs-vite-sdv12gaw?file=src%2FApp.tsx

@laske185
Copy link
Contributor Author

Verhalten der Checkbox passt. Muss in Doku erklärt werden.

@laske185 laske185 assigned laske185 and unassigned sdvg Feb 20, 2025
@laske185 laske185 added the doc Improvements or additions to documentation label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation v2 v3 Here are issues that need to be resolved for version 3.
Projects
Status: 🏗 In progress
Development

No branches or pull requests

3 participants