-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
'boolean' widget without default value behaves strangely #1424
Comments
@erquhart/ @papandreou is this issue still valid? It's open but it looks like a fix was merged for widgets. Just looking for an issue to help out with :) |
@TatisLois, I can still reproduce it with netlify-cms@2.3.2. Which fix is that? |
#1662 was never merged, that's probably why it didn't have an effect 😆 |
@TatisLois If you are still up for this, I can guide you on how to implement a simple fix for this issue. |
@barthc that would be great, would love to take a crack at it |
@TatisLois take a look at the createEmptyDraftData function, just check for |
I opened a PR in #2525. Reviews are welcome 😊 |
This should be resolved when #1407 is resolved. Leaving open until then. |
Specifying a |
Hi @miguelt1, the best way to move this issue forward is to submit a contribution for it |
- Do you want to request a feature or report a bug?
bug
- What is the current behavior?
A
boolean
field without adefault
defined in config.yml will initially render asfalse
, but the field will fail the required check:Clicking the widget twice so it turns on and back off allows me to persist a value of
false
.- If the current behavior is a bug, please provide the steps to reproduce.
You'll get an "AWESOME IS REQUIRED" error.
For the record, specifying
default: false
for the field makes the problem disappear.Because
default
presently doesn't work for editor components, this problem makes it hard to get theboolean
widget working in that setting.- What is the expected behavior?
That the error does not show and
awesome: false
gets persisted. Or that an error is thrown early because the field doesn't have adefault
specified. Alternatively that a distinct "undefined" state be added for boolean fields so that you could at least tell the difference between "off" and "undefined".- Please mention your versions where applicable.
Netlify CMS version: 1.8.4
Browser version: 67.0.3396.62/OSX
Node.JS version: 9.5.0
Operating System: Mac OSX 10.13.4 (High Sierra)
The text was updated successfully, but these errors were encountered: