[MGNLUI-6906] Switchable field doesn't keep the defaultValue on multi language componentes Created: 08/Oct/21  Updated: 21/Jun/23  Resolved: 09/May/23

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.12
Fix Version/s: 6.2.14

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Adam Siska
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Relates
relates to MGNLUI-6833 Default values on internationalized f... Closed
relation
is related to MGNLUI-7030 Switchable field creates empty conten... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[X]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: UI Maintenance 2
Story Points: 2
Team: Nucleus

 Description   

Steps to reproduce

  1.  Create a switchable field like the example we provide at our docu
    myComponent.yaml
    form:
      properties:
        switchable:
          $type: switchableField
          i18n: true
          field:
            $type: radioButtonGroupField
            layout: horizontal
            defaultValue: foo
            datasource:
              $type: optionListDatasource
              options:
                - name: foo
                  value: foo
                - name: bar
                  value: bar
          itemProvider:
            $type: jcrChildNodeProvider
          forms:
            - name: foo
              properties:
                foo:
                  $type: textField
            - name: bar
              properties:
                bar:
                  $type: richTextField
  2.  Create the component on a site which has multiple languages enabled
  3.  Check the defaultValue is selected when opening the dialog
  4.  Switch from fallback local to another one
  5.  Check the defaultValue is not selected

Expected results

When user switch language, the defaultValue is selected

Actual results

The defaultValue is only selected for the default language when opening the dialog

Workaround

N/A

Development notes

Tested on Magnolia 5.7 and the "selected" option was working as expected. When you switch between languages, the "selected" option is always properly marked.

Anyhow, even using the old UI 5 dialog definition, it doesn't work on Magnolia 6, e.g:

myOldDefinition.yaml
form:
  tabs:
    - name: tabText
      label: Text
      fields:
        - name: message
          class: info.magnolia.ui.form.field.definition.SwitchableFieldDefinition
          label: Message
          i18n: true
          options:
            - name: plainText
              label: Plain
              selected: true
              value: plainText
            - name: richText
              label: Rich
              value: richText
          fields:
            - name: plainText
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
              label: Plain text message
              rows: 5
            - name: richText
              class: info.magnolia.ui.form.field.definition.RichTextFieldDefinition
              label: Rich text message
              height: 200

actions:
  commit:
    class: info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
  cancel:
    class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition


 Comments   
Comment by Roman Kovařík [ 05/Nov/21 ]

Estimated: test after MGNLUI-6833 is fixed (possibly add fake ui test)

Comment by Adam Siska [ 30/Nov/21 ]

For RN: Configured default values are prefilled into fields for all languages/locales. (same as for MGNLUI-6833)

Generated at Mon Feb 12 09:41:12 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.