Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualBuilder :: CheckboxesContainer fails to show selected option when using a default value #121

Open
carlfromfelton opened this issue Dec 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@carlfromfelton
Copy link

carlfromfelton commented Dec 16, 2024

Problem Description

  1. Describe what you did
    I am working on my third party module conversion and need a CheckboxesContainer that by defaults have one item checked.

On settings-content.tsx

<FieldContainer
                    attrName="overlayData.innerContent"
                    label={__('Data In Overlay', 'dp-ddg')}
                    description={__('Choose the elements you would like displayed over the image in the overlay.', 'dp-ddg')}
                    features={{
                        sticky: false,
                        hover: false,
                        responsive: false,
                    }}
                    defaultAttr={defaultSettingsAttrs?.overlayData?.innerContent}
                    visible={showOverlay === 'on'}>
                    <CheckboxesContainer options={[
        {value: 'title', label: __('Title', 'dp-ddg')},
        {value: 'caption', label: __('Caption', 'dp-ddg')},
        {value: 'description', label: __('Description', 'dp-ddg')},
    ]}/>

On module-json

"overlayData": {
      "type": "object",
      "default": {
        "innerContent": {
          "desktop": {
            "value": [
              "title"
            ]
          }
        }
      }
    },
  1. Describe what you expected to happen
    I expected to see the default values on the checkboxes checked when the module is added for the first time.

  2. Describe what actually happened
    The checkboxes show with no value checked. But if I log the option value I can see the default values

Screenshot 2024-12-16 at 9 05 38 AM
Screenshot 2024-12-16 at 9 05 46 AM
Screenshot 2024-12-16 at 9 06 04 AM
Screenshot 2024-12-16 at 9 23 21 AM

Related Links or Information

If applicable, please provide links to any related issues, PRs, discord discussions, or other information.

Screenshot and/or gif

System Information

  • Divi version: 5.0.0-dev-alpha.5
  • Operating System: macOS 10.15.7
  • Browser: Chrome 130
  • PHP version: 8.3
  • MySQL version: 8.0.16
  • Web Server: Apache
  • WordPress version: 6.7

Due Diligence Checklist

  • [ x] I searched for similar issues before opening this one
  • [ x] I have tested with all plugins deactivated except Elegant Themes Beta Tester
  • [ x] I have tested with the latest alpga/beta version of Divi
  • [ x] I used a clear and descriptive title
  • [ x] I have included a detailed description
  • [ x] I have included steps to reproduce
  • [ x] I have included relevant links or information
  • [ x] I have included a video or gif or screenshot
@carlfromfelton carlfromfelton added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant