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

auro-radio: Required attribute always displays radios as error #125

Closed
B-E-A-F opened this issue Mar 26, 2024 · 6 comments · Fixed by #131
Closed

auro-radio: Required attribute always displays radios as error #125

B-E-A-F opened this issue Mar 26, 2024 · 6 comments · Fixed by #131
Assignees
Labels
auro-radio Type: Bug Bug or Bug fixes

Comments

@B-E-A-F
Copy link

B-E-A-F commented Mar 26, 2024

Please verify the version of auro-radio you have installed

2.2.2

Please describe the bug

  1. Add auro radio to your project
  2. Set the required attribute on your auro-radio-group to true
  3. Select an auro radio
  4. See that the radio group is highlighted in red

Reproducing the error

This issue cannot be reproduced on the Auro docsite

Expected behavior

When selecting an auro radio item it should not always highlight in red after selecting a radio item.

What browsers are you seeing the problem on?

Chrome

Additional context

Was not able to reproduce this in the docs site, however, copy pasting the "required" code example you will see the same issue. I reproduced this on both an existing project, as well as a new project.

I am unable to upgrade to @aurodesignsystem/auro-radio until this is fixed. I tried every version, and I still got the same issue on all versions.

Before clicking:
image
After clicking:
image

Not able to reproduce on "@alaskaairux/auro-radio": "^1.6.2"

Exit criteria

The issue can be closed once the error is corrected, or the docs have been updated to correctly represent how the required attribute should work.

@B-E-A-F B-E-A-F added auro-radio not-reviewed Issue has not been reviewed by Auro team members Type: Bug Bug or Bug fixes labels Mar 26, 2024
@jordanjones243 jordanjones243 removed the not-reviewed Issue has not been reviewed by Auro team members label Mar 26, 2024
@jordanjones243
Copy link
Contributor

@ArcherScript Can you reconfirm which version of auro-radio you have installed? The current version is 2.2.2 and that does not match up with what you listed.

@jordanjones243
Copy link
Contributor

@ArcherScript Would you also be able to send a screenshot of how you are using auro-radio? It is hard to say whether this is a bug or implementation error since this is not reproducible on the docsite.

@B-E-A-F
Copy link
Author

B-E-A-F commented Mar 26, 2024

I can share the code file of how we are implementing auro-radio. Upgrading to the aurodesignsystem version is the only thing that changed when I started running into issues. Also, I've updated the original issue to the correct version with the issues.

<script context="module">
    let counter = 0;
</script>

<script lang="ts">
    // TODO: We can't upgrade to aurodesignsystem/auro-radio-group because of an outstanding bug
    // https://github.com/AlaskaAirlines/auro-radio/issues/125
    import '@alaskaairux/auro-radio';
    export let values: (string | boolean)[];
    export let options: string[];
    export let name;
    export let selected = values[0];

    const id = `radiogroup-${counter}`;
    counter++;

    function handleInput(e) {
        selected = values.find(val => e.target.value === val);
    }
</script>

<auro-radio-group required on:input={handleInput} data-testid={name}>
    <div slot="legend">
        <slot name="label" />
    </div>
    {#each values as value, i}
        <auro-radio
            id="{id}-{i}"
            {name}
            data-testid="{name}-{i}"
            {value}
            checked={value === selected}><span>{options[i]}</span></auro-radio
        >
    {/each}
</auro-radio-group>

<style>
    auro-radio span {
        line-height: 1.625;
        padding-top: 0.3rem;
        display: inline-block;
    }

    auro-radio {
        margin-bottom: 1rem;
    }
</style>

@jordanjones243
Copy link
Contributor

Can you tell me what validity state your radio-group is in when this error occurs? You should be able to see the validity attribute on the component in the DOM. @ArcherScript

@B-E-A-F
Copy link
Author

B-E-A-F commented Mar 27, 2024

Validated that it is initialized at "valueMissing", and updates to "valueMissing" upon selection.

validity="valueMissing"

Here's a code snippet of its use:

        <RadioGroup
            name="language"
            options={['English', 'Español']}
            values={['en', 'es']}
            bind:selected
            >
            <p slot="label" class="select-lang">
                {$_('language_selector')}
            </p>
        </RadioGroup>

@jordanjones243
Copy link
Contributor

During testing/bug exploration, I have created a dynamic example where radio buttons are created and inserted on JavaScript execution. I was able to reproduce the error documented in this issue and can verify that this is a valid bug. The example will be added to the docsite and when the bug fix is released.

@jordanjones243 jordanjones243 linked a pull request Apr 1, 2024 that will close this issue
6 tasks
@jordanjones243 jordanjones243 mentioned this issue May 13, 2024
6 tasks
blackfalcon pushed a commit that referenced this issue May 13, 2024
# [3.0.0](v2.2.2...v3.0.0) (2024-05-13)

### Bug Fixes

* **required:** stop error ui in dynamic implementation [#125](#125) ([a19944a](a19944a))

### Features

* **event:** add events dispatched by validation repo ([0750f4a](0750f4a))
* **library:** add library to repo for custom component use ([d85ef20](d85ef20))
* **selected:** add optionSelected attribute to radio group [#97](#97) ([ba37820](ba37820))
* **validation:** install and use formvalidation repo ([5e4cd59](5e4cd59))

### Performance Improvements

* **error:** update error handling ([11cf71d](11cf71d))
* **validation:** update logic around validation handling [#125](#125) ([3d79361](3d79361))

### BREAKING CHANGES

* **validation:** The current validation has been removed and replaced by the auro-formvalidation repo to keep validation consistent across all form components.
@jason-capsule42 jason-capsule42 linked a pull request May 14, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auro-radio Type: Bug Bug or Bug fixes
Projects
None yet
4 participants