neos-ui icon indicating copy to clipboard operation
neos-ui copied to clipboard

Add allowEmpty option to RangeSlider

Open jonnitto opened this issue 3 years ago • 6 comments

Currently, the range slider can not be empty. We should ad this option

jonnitto avatar Dec 16 '21 13:12 jonnitto

Styling is hard:

CleanShot 2021-12-16 at 14 48 57@2x

or

CleanShot 2021-12-16 at 14 49 35@2x

or

CleanShot 2021-12-16 at 14 53 11@2x

Personally, I think option three is the best

jonnitto avatar Dec 16 '21 13:12 jonnitto

BTW, this works only properly if the type of the property is a string, otherwise, it will set it the value to 0.

jonnitto avatar Dec 16 '21 16:12 jonnitto

is this range editor the first editor with type int|null ? - i guess currently a none value is casted to 0 right?

mhsdesign avatar Dec 16 '21 17:12 mhsdesign

i think this fat 'X' button is (always) quite massive - and i see many editors applying them. Can there be maybe a more subtle way? Lightroom (adobe) handles this by displaying an option 'reset' above each control group when holding alt/option... but that may be overkill for editors.

how about double clicking the blue slide handle (but that should probably be reserved for resetting to defaultValue)

mhsdesign avatar Dec 16 '21 17:12 mhsdesign

image

Maybe we can add an empty button and reset to default button like this - or similar

mhsdesign avatar Mar 03 '22 10:03 mhsdesign

Why should it be empty if min and max are always required / have defaults?

Sebobo avatar Mar 18 '22 21:03 Sebobo

Should we close this? IMO it doesn't make so much sense to have required min/max values and defaults and then allow null

Sebobo avatar Oct 11 '22 07:10 Sebobo

Yep, let's close this

jonnitto avatar Oct 12 '22 21:10 jonnitto

@grebaldi i just remembered this one while testing https://github.com/neos/neos-ui/pull/3535 - as its now possible to set integer types to null via the ui, should we allow it also for the range editor?

My general thought is that unless you have a property with an notemptyvalidator its ALWAYS legal to set the property to null. And thus it should also be doable via the ui.

mhsdesign avatar Jul 05 '23 06:07 mhsdesign

I think we need to approach this entire problem differently.

It's a bit awkward imho that we rely on the presence of some Neos.Neos/Validation/NotEmptyValidator to figure out whether a property is mandatory or optional. In fact, we don't really ever know whether a property is mandatory or optional.

I think nullability should be part of the NodeType Schema, either through type description

properties:
  myOptionalIntegerProperty:
    type: ?integer

or through flag

properties:
  myOptionalIntegerProperty:
    type: integer
    required: false # or `optional: true`

This should imply the presence of Neos.Neos/Validation/NotEmptyValidator, while it also allows the editor implementation to make decisions based on the nullability of the given property type.

This doesn't solve the particular design problem here, but at least it would give us a basis to decide whether or not to show a "clear"- or "reset"-button.

grebaldi avatar Jul 05 '23 09:07 grebaldi

@grebaldi exactly what @bwaidelich and me have in mind ;) https://github.com/neos/neos-development-collection/issues/4304#issuecomment-1578965994 the validators are dirt ^^

mhsdesign avatar Jul 05 '23 09:07 mhsdesign

the required flag could also replace the allowEmpty flag for selectboxes

mhsdesign avatar Jul 05 '23 09:07 mhsdesign