Skip to content

CheckBox: Visible checked state of the Checkbox changes even checked property is set to specific value #5971

@sadie100

Description

@sadie100

Describe the bug

Even if I fix the checked property of the CheckBox to false(or true), the visible checked state of the CheckBox changes every time when the user clicks on it.
This is unexpected, because the basic html checkbox input(input type='checkbox') acts as frozen if the checked property is fixed with certain value. (I added this case on the StackBlitz example for compare)

If this is by design and not a bug, please consider fixing the feature. We can't control the value now.
I need to connect some data logic to the CheckBox's onChange property, and I want the 'checked' property to be controlled by our state. (So that we can cancel the check action if the data logic fails).
But now the property is always changing regardless of 'checked', so there's no way to control the displayed checked property.

I've also checked the Switch component which has 'checked' property too, and it behaves the same way. I'd appreciate it if you could look at that as well.

Isolated Example

https://stackblitz.com/edit/github-kacj2o-fej5h6?file=src%2FApp.tsx

Reproduction steps

  1. Set the CheckBox checked property to certain value(true or false)
  2. Click the CheckBox

Expected Behaviour

If checked value is not changed, UI should not be changed.

Screenshots or Videos

No response

UI5 Web Components for React Version

1.29.0

UI5 Web Components Version

1.24.0

Browser

Chrome

Operating System

No response

Additional Context

No response

Relevant log output

No response

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions