-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show description for boolean fields #498
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits. We may want to add a small test as well.
<label> | ||
<input type="checkbox" | ||
id={id} | ||
checked={typeof value === "undefined" ? false : value} | ||
required={required} | ||
disabled={disabled} | ||
autoFocus={autofocus} | ||
title={schema.description} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title attribute should be set on the <label>
element, so the tooltip is shown when hovering over the whole widget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the title-attribute completely, since it is redundant with the DescriptionField
above the input.
@@ -13,13 +13,18 @@ function CheckboxWidget({ | |||
}) { | |||
return ( | |||
<div className={`checkbox ${disabled ? "disabled" : ""}`}> | |||
{ schema.description | |||
? <DescriptionField description={ schema.description }/> | |||
: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this could be written as
{ schema.description && <DescriptionField description={ schema.description }/> }
Thanks for the feedback. Should be good to go now! |
Thanks! |
New features * Add support for rows attribute of textarea widget. (#450) * #434 - Render empty array item fields when minItems is specified (#484) * Add a "has-danger" class to the form error list (#502) * Show description for boolean fields (#498) * Fix #488: Add a custom Form ErrorList prop. Bugfixes * Fix impossibility to use stateful ArrayFieldTeplate comp. (#519) * Centralized shouldComponentUpdate handling in SchemaField (#490)
Released in v0.44.0. |
Reasons for making this change
A fix for #435 . I chose to present the description in a similar way like the other fields, with an extra text above the input. The suggested
title
looked a bit "strange" since it was the only input with that kind of behavior and it would probably have issues in a mobile view.Checklist