Skip to content

code editor: make it invalid when the value is invalidΒ #3764

@Kiarokh

Description

@Kiarokh

When the code inside the Code Editor is invalid (e.g. contains lint errors), the component renders a visual element <div class="CodeMirror-gutter-elt" inside <div class="CodeMirror-gutter-wrapper".

Now that the component has an invalid prop: #3763 we can use this internal validation mechanisms to set the component to invalid, when its value is invalid. For example, when the value contains lint errors.

The invalid prop in limel-code-editor has proper accessibility support, and is better wired for indicating the invalid state.

Image

That alert of "Should be a valid JSON" doesn't need to be displayed like this anymore:

props.onValidate('Should be a valid JSON document');

We need to revisit this form widget, and instead use helperText,

https://github.com/Lundalogik/lime-elements/blob/main/src/components/form/widgets/code-editor.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityIssues that make it harder, or even impossible, for some specific group of users to use the softwaremaintenanceThings that are important but not urgent, and not directly related to any specific bug or featureusabilityThings that make it harder or easier for users to understand or use elements

    Type

    No type

    Projects

    Status

    All Open Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions