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

[bug]: RadioGroup cannot pass a disabled attribute to the Radio component #2270

Closed
1 of 8 tasks
mikhaelbois opened this issue Mar 19, 2020 · 1 comment · Fixed by #2313
Closed
1 of 8 tasks

[bug]: RadioGroup cannot pass a disabled attribute to the Radio component #2270

mikhaelbois opened this issue Mar 19, 2020 · 1 comment · Fixed by #2313
Assignees
Labels
bug Something isn't working help wanted Eligible for community contribution.

Comments

@mikhaelbois
Copy link
Contributor

mikhaelbois commented Mar 19, 2020

Describe the bug
When using the RadioGroup component, we cannot specify if its items are disabled or not.

https://github.com/magento/pwa-studio/blob/develop/packages/venia-ui/lib/components/RadioGroup/radioGroup.js#L34
In the RadioGroup component, the items only accepts a label and a value.

Expected behavior
We should have a way to render the Radio items as disabled or not.

Possible solutions
We could pass additional attributes to the item via an attributes key of the items prop.

const options = items.map(({ label, value, attributes }) => (
    <Radio
        classes={{
            label: classes.radioLabel,
            root: classes.radio
        }}
        key={value}
        label={label}
        value={value}
        {...attributes}
    />
));

/* --- */

const items = [
    { label: 'Enabled item', value: 'value_1' },
    {
        label: 'Disabled item',
        value: 'value_2',
        attributes: { disabled: true }
    }
];

/* --- */

<RadioGroup
    field="disabled_example"
    items={items}
/>

Please complete the following device information:

  • Magento Version: 2.3.4
  • PWA Studio Version: 5.0.1
  • NPM version: 6.11.3
  • Node Version: 10.17.0

Please let us know what packages this bug is in regards to:

  • venia-concept
  • venia-ui
  • pwa-buildpack
  • peregrine
  • pwa-devdocs
  • upward-js
  • upward-spec
  • create-pwa
@mikhaelbois mikhaelbois added the bug Something isn't working label Mar 19, 2020
@Jordaneisenburger Jordaneisenburger added the help wanted Eligible for community contribution. label Mar 24, 2020
@awilcoxa
Copy link

Good value add and relatively low LOE, moving to prioritized for pickup by interested community member(s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Eligible for community contribution.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants