Skip to content
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

range field now correctly takes 0 into account #4822

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* a11y improvements for context menus.
* Fixes broken widget preview URL when the image is overridden (module improve) and external build module is registered.
* Inject dynamic custom bundle CSS when using external build module with no CSS entry point.
* Range field now correctly takes 0 into account.

### Adds

Expand Down
4 changes: 2 additions & 2 deletions modules/@apostrophecms/schema/ui/apos/logic/AposInputRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
// The range spec defaults to a value of midway between the min and max
// Example: a range with an unset value and a min of 0 and max of 100 will become 50
// This does not allow ranges to go unset :(
if (!this.next) {
if (!this.next && this.next !== 0) {
this.unset();
}
},
Expand All @@ -47,7 +47,7 @@ export default {
},
validate(value) {
if (this.field.required) {
if (!value) {
if (!value && value !== 0) {
return 'required';
}
}
Expand Down
Loading