Skip to content

shadcn error highlight not working on parent objects #4642

@Hiraqui

Description

@Hiraqui

Prerequisites

What theme are you using?

shadcn

Version

6.0.0-beta.10

Current Behavior

I'm trying to use extraErrors to show a error on a property of type object that has multiple properties. In the default theme works fine, highlighting all fields of the object as error, but with shadcn theme it displays the error and no highlighting of fields.

Expected Behavior

All fields that are properties of the object should be highlighted like in the default theme

Steps To Reproduce

BTW: I tried sharing the link of the playground but it doesn't load correctly (missing extraErrors textarea)

  1. Go to the playground
  2. Select ErrorSchema option
  3. Use this schema:
{
  "title": "A registration form",
  "description": "A simple form example.",
  "type": "object",
  "required": [
    "firstName",
    "lastName"
  ],
  "properties": {
    "firstName": {
      "type": "string",
      "title": "First name",
      "default": "Chuck"
    },
    "lastName": {
      "type": "string",
      "title": "Last name"
    },
    "age": {
      "type": "integer",
      "title": "Age"
    },
    "password": {
      "type": "string",
      "title": "Password",
      "minLength": 3
    },
    "contact": {
      "type": "object",
      "properties": {
        "bio": {
          "type": "string",
          "title": "Bio"
        },
        "telephone": {
          "type": "string",
          "title": "Telephone",
          "minLength": 10
        }
      }
    }
  }
}
  1. Use this extraErrors:
{
  "contact": {
    "__errors": [
      "some error that got added as a prop"
    ]
  }
}
  1. See fields correctly highlighted
  2. Select shadcn theme
  3. Fields are not highlighted anymore

Environment

- OS: Windows 10
- Node: 22.13.11
- pnpm: 10.7.0

Anything else?

With default theme:

Image

With shadcn theme:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions