Skip to content

Tabs field not entirely hidden by condition #12761

Open
@bratvanov

Description

@bratvanov

Describe the Bug

When hiding a tabs field with a condition on another field, only the child fields inside the tabs are affected by the condition, but the UI of the tabs field (the tabs themselves and the description) are unaffected.

Image
Image

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/tree/main/templates/website

Reproduction Steps

fields: [
  {
    name: 'enableTabs',
    type: 'checkbox',
    label: 'Enable Tabs',
    defaultValue: false,
  },
  {
    type: 'tabs',
    tabs: [
      {
        label: 'Tab 1',
        description: 'Test description for Tab 1',
        fields: [
          {
            name: 'test1',
            type: 'text',
            label: 'Test Field 1',
          },
        ],
      },
      {
        label: 'Tab 2',
        description: 'Test description for Tab 2',
        fields: [
          {
            name: 'test2',
            type: 'text',
            label: 'Test Field 2',
          },
        ],
      },
    ],
    admin: {
      condition: (data, siblingData) => data.enableTabs === true,
    },
  },
]

Which area(s) are affected? (Select all that apply)

area: ui, area: core

Environment Info

Node: 22.12.0
npm: 11.0.0
payload: 3.42.0
next: 15.3.0
@payloadcms/db-mongodb: 3.42.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions