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

Description is not rendered for array type #2122

Closed
hungbie opened this issue Mar 31, 2023 · 9 comments · Fixed by #2227
Closed

Description is not rendered for array type #2122

hungbie opened this issue Mar 31, 2023 · 9 comments · Fixed by #2227

Comments

@hungbie
Copy link

hungbie commented Mar 31, 2023

Describe the bug

Normally, a description will be render for the field if they have description in their schema.
However, for field of type array, the description field is not being rendered.

Expected behavior

description being rendered.

Steps to reproduce the issue

Example code:

import React from 'react';
import { JsonForms } from '@jsonforms/react';
import {
  materialRenderers,
  materialCells,
} from '@jsonforms/material-renderers';

export default function ExampleJsonForm() {
  const schema = {
    type: 'object',
    description: 'This is a description of the object.',
    properties: {
      comments: {
        type: 'array',
        description: 'This is a description of the comments array.',
        items: {
          type: 'object',
          properties: {
            unfocusedDescription: {
              type: 'string',
              description: 'This description is shown even when the control is not focused',
            },
          },
        },
      },
      unfocusedDescription: {
        type: 'string',
        description: 'This description is shown even when the control is not focused',
      },
    },
  };
  const uischema = {
    type: 'VerticalLayout',
    elements: [
      {
        type: 'Control',
        scope: '#/properties/comments',
        options: {
          showUnfocusedDescription: true,
        },
      },
      {
        type: 'Control',
        scope: '#/properties/unfocusedDescription',
        options: {
          showUnfocusedDescription: true,
        },
      },
    ],
  };
  const data = {
  };
  return (
      <JsonForms
        schema={schema}
        uischema={uischema}
        data={data}
        renderers={materialRenderers}
        cells={materialCells}
      />
  );
}

Screenshots

Screenshot 2023-03-31 at 4 31 36 PM

In which browser are you experiencing the issue?

Google Chrome Version 111.0.5563.110 (Official Build) (x86_64)

Which Version of JSON Forms are you using?

v3.0.0

Framework

React

RendererSet

Material

Additional context

No response

@hungbie
Copy link
Author

hungbie commented Apr 10, 2023

hope someone can take a look at this

@sdirix
Copy link
Member

sdirix commented Apr 11, 2023

Hi @hungbie, our array renderer does not print the description anywhere. I could imagine to support it as an overlay to the array label, similar to the boolean controls. Would you like to contribute this feature?

@hungbie
Copy link
Author

hungbie commented Apr 12, 2023

@sdirix sure. Happy to contribute, can you give me some pointers to where should I put this enhancement in?

@sdirix
Copy link
Member

sdirix commented Apr 20, 2023

For the Array Table Renderer, the description needs to be added here. It should already be available via the props. For the Array List Renderer it needs to be added here. The description should also already be available there.

@SaSteffen
Copy link
Contributor

@hungbie Did you come around to doing this? I'd jump in otherwise.
@sdirix :
This is done via FormHelperText like here, correct?

@sdirix
Copy link
Member

sdirix commented Dec 12, 2023

I'm not sure the FormHelperText is the best choice here, as the title of the array is not really a form or input. Feel free to try it, however I guess we will need to manually create a Typography element which looks good.

Alternatively we could just render it as a tooltip as we can't do any proper focus management here.

@hungbie
Copy link
Author

hungbie commented Dec 12, 2023

@hungbie Did you come around to doing this? I'd jump in otherwise. @sdirix : This is done via FormHelperText like here, correct?

Hi! I didn’t find the time to work on this but really appreciate if this can be done! Thank you!

@SaSteffen
Copy link
Contributor

Made a minimal change. This would work for my use case.

@sdirix
Copy link
Member

sdirix commented Jan 30, 2024

Implemented with #2227. Thanks!

@sdirix sdirix closed this as completed Jan 30, 2024
@sdirix sdirix linked a pull request Jan 30, 2024 that will close this issue
@sdirix sdirix modified the milestones: next, 3.2 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants