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

ImageCropper AspectRatioDropDown can always deselect preset

Open PRGfx opened this issue 1 year ago • 0 comments

Description

Sometimes the user may select one of the configured aspect-ratios, e.g. choose between landscape and portrait. However, as soon as I provide the option to select an aspect-ratio preset, I can clear the selection and freely draw my cropping area.

Steps to Reproduce

  1. Configure a property with an image, forcing the editor to crop the image to one of the provided aspect-ratios
properties:
  image:
    type: Neos\Media\Domain\Model\ImageInterface
    ui:
      inspector:
        editorOptions:
          features:
            crop: true
           crop:
             aspectRatio:
               # we want to force an aspect-ratio when selecting the image
               forceCrop: true
               # we explicitely don't want custom aspect-ratios
               allowCustom: false
               # we set a defaultOption so we don't end up without selected aspect-ratio
               defaultOption: portrait
               options:
                 portrait:
                   label: Portrait
                   width: 2
                   height: 3
                 landscape:
                   label: Landscape
                   width: 3
                   height: 2
  1. Select an image, clear the selected aspect ratio, modify the cropping area at will

Expected behavior

The user should not be able to clear the selected preset. Arguably defaultOption should be optional as well (and default to the first valid option) if the cropping-configuration is not locked and custom configuration is not permitted.

Actual behavior

There is a button to clear the selected aspect ratio in the AspectRatioDropDown as soon as something is selected and there is no way to configure the editor to not provide this option.

After deselecting the configured preset the user can select any aspect-ratio they want.

Affected Versions

Neos: 5.3 - today UI: This seems to never having changed (also see #2909)

PRGfx avatar Dec 11 '23 18:12 PRGfx