react-jsonschema-form
react-jsonschema-form copied to clipboard
`title` keyword does not work for some object properties
Prerequisites
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [X] I have read the documentation
- [X] Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
core
Version
5.6.2
Current Behavior
With the following schema, only first property (t
) gets its title displayed properly. The second property (t2
) displays the property name as a title (playground link):
{
"type": "object",
"properties": {
"t": {
"type": "string",
"title": "TITLE"
},
"t2": {
"type": "string",
"title:": "TITLE"
}
}
}
This behaviour seems to be related to property name and order, and can be widely reproduced with many different keys (example playground).
It can be circumvented via ui:title
(playground link)
Expected Behavior
I am expecting all fields to be titled TITLE
Steps To Reproduce
See the playgrounds above
Anything else?
I'm not sure what to think of this, it seems to me like the title
keyword is fundamentally broken in current release - so maybe I'm just missing something.
Thanks for the report @michal-kurz --this is a strange issue. The issue persists across all themes, so it's probably in a shared component like SchemaField.
@michal-kurz I think there's just a typo in the schema, "title:"
should be "title"
. Can you verify if this is the issue? 🙂
@nickgros Yeah... I feel pretty stupid. Both my colleague and I spent over an hour each on this 😅
Thanks for pointing it out, and sorry for wasting your time