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

Update position of description for individual radio or checkbox #2043

Open
davicostalf opened this issue Nov 6, 2024 · 1 comment
Open
Labels
bug Something isn't working dev wanted Indicates that additional help or expertise from engineering is needed to address the issue.

Comments

@davicostalf
Copy link
Contributor

davicostalf commented Nov 6, 2024

When a field is used for a individual radio or checkbox, the position of the description is not correct. It should be directly below the label, to communicate the hierarchy properly. If it's not position this way, it can be confused with the description of the group.

Current implementation
image

      <RadioGroup label="Radio group">
        <Field>
          <Radio value="1">Option 1</Radio>
          <FieldDescription>
            By clicking you agree with terms and conditions
          </FieldDescription>
        </Field>
        <Field>
          <Radio value="2">Option 2</Radio>
          <FieldDescription>
            By clicking you agree with terms and conditions
          </FieldDescription>
        </Field>
        <Radio value="3">Option 3</Radio>
      </RadioGroup>

Ideal implementation (2px below the label)
image

@davicostalf davicostalf added the bug Something isn't working label Nov 6, 2024
@davicostalf davicostalf added the dev wanted Indicates that additional help or expertise from engineering is needed to address the issue. label Nov 6, 2024
@lucasaarcoverde
Copy link
Contributor

Uma maneira possível de chegar a esse comportamento é reutilizando o estilo do FieldDescription para adicionar o help text no label da opção:

<RadioGroup label="Radio group" description="Help">
  <Radio value="1">
    Option 1
    <div data-sl-field-description>
      By clicking you agree with terms and conditions
    </div>
  </Radio>

    <Radio value="2">
      Option 2
      <div data-sl-field-description>
        By clicking you agree with terms and conditions
      </div>
  </Radio>
</RadioGroup>

Uma outra sugestão foi a de reutilizar o Field em si para construção desse comportamento envolvendo o Radio com o Field e adicionando FieldDescription, porém isso causa problemas de acessibilidade já que significaria renderizar vários fields dentro de um field que é o RadioGroup.

Link para sandbox

@beatrizmilhomem beatrizmilhomem moved this to Discussing in Shoreline Nov 8, 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 dev wanted Indicates that additional help or expertise from engineering is needed to address the issue.
Projects
Status: Discussing
Development

No branches or pull requests

2 participants