json-editor / json-editor

JSON Schema Based Editor
MIT License
4.43k stars 654 forks source link

Spectre theme does not render checkbox inputs in a table #873

Closed mstokes-f5 closed 3 years ago

mstokes-f5 commented 3 years ago

General information

Expected behavior

When an array of objects is rendered using the table format and contains a boolean property with the checkbox format the boolean property should get a checkbox in the table.

Actual behavior

The bootstrap4 theme behaves as expected, but the spectre theme results in no checkbox. image

Steps to reproduce the behavior

The following schema can be used to reproduce the issue:

{
  "type": "object",
  "required": [
    "members"
  ],
  "properties": {
    "members": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "intval",
          "boolval"
        ],
        "properties": {
          "intval": {
            "type": "integer",
            "default": 0
          },
          "boolval": {
            "type": "boolean",
            "default": false,
            "format": "checkbox"
          }
        }
      },
      "format": "table"
    }
  }
}

Speculation on cause

I believe this happens since the checkbox does not have a label when rendered in a table, and spectreTheme.getFormControl() does not have a branch that handles checkboxes without a label. However, fixing that still results in inconsistent styling on the checkbox. In other words, a checkbox rendered in the table has a different style than one rendered outside the table.

germanbisurgi commented 3 years ago

fixed in #943