keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.65k stars 2.21k forks source link

Admin UI: cannot override inherited field with hidden:true #4973

Open dfinton opened 4 years ago

dfinton commented 4 years ago

Expected behavior

When inheriting from a parent list, some fields may need to be hidden in some of the children.

This appears to be the same issue that was opened back in 2016 that was later resolved. So the behavior we're seeing is almost definitely a regression: https://github.com/keystonejs/keystone/issues/2941

Actual/Current behavior

Other properties, like noedit, initial, default, required can all be overridden just by re-add the field with the same name in the child list. the hidden field, no matter what we do, does not appear to force the UI to not display the field.

Steps to reproduce the actual/current behavior

Pseudo code:

parent.add({
  type: Types.Datetime,
  utc: true,
  format: 'YYYY-MM-DD',
  default: new Date(),
  required: true,
  initial: true,
});

child.add({
  type: Types.Datetime,
  utc: true,
  format: 'YYYY-MM-DD',
  required: false,
  initial: false,
  hidden: true,
  noedit: true,
});

I did some testing with Types.Text type fields just to see if it was specifically related to the DateTime fields, but the problem is reproducible independent of field type based on my limited testing.

Environment

Software Version
Keystone 4.2.1
Node.js 10.15.3 (other LTS versions also show same behavior)
Browser Chrome/Firefox, latest versions