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

[fluent-ui] Same property named Boolean Checkbox bug #2138

Closed
3 tasks done
fadhilx opened this issue Nov 22, 2020 · 2 comments
Closed
3 tasks done

[fluent-ui] Same property named Boolean Checkbox bug #2138

fadhilx opened this issue Nov 22, 2020 · 2 comments
Labels

Comments

@fadhilx
Copy link

fadhilx commented Nov 22, 2020

Prerequisites

Description

when there is two or more object that have same key with type boolean(which will become checkbox), when you click the checkbox thats not the first one, it will change the state of the first checkbox.

Steps to Reproduce

  1. open this playground link or use this schema:
{
  "properties": {
    "lorem": {
      "title": "Lorem",
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        }
      }
    },

    "ipsum": {
      "title": "Ipsum",
      "type": "object",
      "properties": {
        "enabled_2": {
          "type": "boolean",
          "default": true
        },
        "enabled": {
          "title":"enabled <------- (CLICK ME)",
          "type": "boolean",
          "default": true
        }
      }
    },

    "sit": {
      "title": "Sit",
      "type": "object",
      "properties": {

        "enabled": {
          "title":"enabled <------- (Or ME)",
          "type": "boolean",
          "default": true
        },
        "otherCheckbox": {
          "type": "boolean",
          "default": true
        }
      }
    }
  }
}

make sure that you use fluent ui.
2. click the second or enabled's checkbox on the UI
3. you can change to any key, name it to what ever you want as long it have the same property name with other object property

Expected behavior

the next same property should be able to be click, cause it in different object not duplicated, i want to make this kind of output

{
  "weapon 1": {
    "enabled": true
  },
  "weapon 2": {
    "enabled": false
  },
  "weapon 3": {
    "enabled": true
  }
}

Actual behavior

click at the next same property name checkbox cause it unchangeable and will change the first one

Version

{
   ...
    "@fluentui/react-northstar": "^0.51.2",
    "@rjsf/core": "^2.4.0",
    "@rjsf/fluent-ui": "^2.4.0",
   ...
}
@fadhilx
Copy link
Author

fadhilx commented Nov 22, 2020

i found a solution for this
i found out that checkbox id attribute causing that behavior

add type: "object" key as schema root property

{
  "type":"object", //<----add this
  "properties": {
    "lorem": {
      "title": "Lorem",
      ...

just add that to fix the behavior

at this point im not sure if its a bug or it just me who write invalid JSON format.

@epicfaace epicfaace added the bug label Nov 22, 2020
@ar-naseef
Copy link

Has anybody found a solution for this? I am also facing this issue with Fluent UI.!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants