Skip to content

Commit

Permalink
range field now correctly takes 0 into account (#4822)
Browse files Browse the repository at this point in the history
  • Loading branch information
ETLaurent authored Dec 17, 2024
1 parent 72eeeae commit 1038a65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 1038a65

Please sign in to comment.