AndrewHaine / statamic-accordion-group

Stash groups of fields from long fieldsets away in accordion-style toggle boxes.
MIT License
1 stars 1 forks source link

Conditionals not working within accordion group #2

Open justinhough opened 5 years ago

justinhough commented 5 years ago

Thanks for creating this addon. I have used it in a few projects and it works great to keep the editor clean. However, it seems that using conditionals on fields doesn't work within an accordion group.

For example, I have a simple show of two fields when selecting banner_type for color and image. Both fields end up showing within the accordion group when it should only be showing one field depending upon the selection made to banner_type. The same example works fine when loading it via a partial.

Here the example code:

banner_type:
  options:
    color: Color
    image: Image
  type: select
  default: image
  display: Banner Type
banner_color:
  type: colorpicker
  localizable: true
  width: 33
  display: Background Color
  show_when:
    banner_type: color
banner_image:
  container: main
  folder: /
  restrict: false
  type: assets
  localizable: true
  width: 33
  display: Background Image
  max_files: 1
  mode: grid
  show_when:
    banner_type: image

Screenshot of the accordion group: image

AndrewHaine commented 5 years ago

Thanks Justin, appreciate the feedback!

I suspect this is to do with how we are building the child fieldset and inserting it into the accordion box, currently it's a torn down version of the Publish component from core but i'm looking into improving this/getting a fix!