Skip to content

Allow custom renderers to handle the readonly behaviour. #2479

@sarathkcm

Description

@sarathkcm

Is your feature request related to a problem? Please describe.

When using a custom textbox renderer and trying to make it readonly via options, JSON forms is disabling the textbox by passing the enabled prop as false to the renderer.

Ideally this should be upto the renderer to decide whether or not to disable the field based on the readonly option.

As discussed here: #2283 -

It seems that the core runtime is converting readonly to enabled/disabled and not the renderer sets, so it's not possible to override this from renderer sets reliably.

#1735 (comment)
https://github.com/eclipsesource/jsonforms/blob/master/packages/core/src/mappers/util.ts#L24

Readonly and disabled states are semantically different and has different meanings, behaviour and styles.

Describe the solution you'd like

I would like for a custom renderer to receive the enabled prop based only on the rules and not based on any other options defined for the ui schema element. The custom renderer should be able to recieve the enabled prop as well as the uischema options, global config and then decide how to render the field.

Describe alternatives you've considered

I am considering renaming the option readonly to isReadOnly to avoid the issue in the current version of JSON forms. but would love to see a proper solution than this workaround.

Package

Core

Additional context

Feature request raised as per this comment..

#2283 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions