React-jsonschema-form: The ui:widget hidden does not hide description

Created on 1 Apr 2020  路  3Comments  路  Source: rjsf-team/react-jsonschema-form

Prerequisites

@rjsf/material-ui

Description

By hiding a field it should hide all field related ui items (e.g.: labels, description etc.)

Steps to Reproduce

uiSchema

{
      myfield: { 'ui:widget': 'hidden' },
}

schema

{
  "mySchema": {
    "type": "object",
    "properties": {
      "myfield": {
        "type": "string",
        "description": "myfield description"
      }
    }
  }
}

Expected behavior

Whole div element is hidden

<div class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12" style="margin-bottom: 10px;" hidden>
  <div class="MuiFormControl-root MuiFormControl-fullWidth">
    <input id="root_myfield" value="">
    <span class="MuiTypography-root MuiTypography-caption MuiTypography-colorTextSecondary">myfield description</span>
  </div>
</div>

Actual behavior

Description is still visible
Only input field is marked as hidden

<div class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12" style="margin-bottom: 10px;">
  <div class="MuiFormControl-root MuiFormControl-fullWidth">
    <input type="hidden" id="root_myfield" value="">
    <span class="MuiTypography-root MuiTypography-caption MuiTypography-colorTextSecondary">myfield description</span>
  </div>
</div>

Version

"@rjsf/core": "^2.0.0-alpha.4",
"@rjsf/material-ui": "^2.0.0-alpha.4",
bug material-ui

Most helpful comment

image
Not only description, but also the grid is left for the hidden widget (which is not expected)

All 3 comments

One ugly workaround that still adds invisible space: 'ui:description': ' '

image
Not only description, but also the grid is left for the hidden widget (which is not expected)

Any progress or timeline for fixing this bug?

Was this page helpful?
1 / 5 - 1 ratings

Related issues

mfulton26 picture mfulton26  路  3Comments

pablen picture pablen  路  3Comments

norim13 picture norim13  路  3Comments

epicfaace picture epicfaace  路  3Comments

ClockerZadq picture ClockerZadq  路  3Comments