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

Can't use form group with label (Pico v2) #365

Open
ASOwnerYT opened this issue May 26, 2023 · 3 comments
Open

Can't use form group with label (Pico v2) #365

ASOwnerYT opened this issue May 26, 2023 · 3 comments
Labels

Comments

@ASOwnerYT
Copy link

Please search for duplicate or closed issues first.

Describe the issue

When I use a label tag in <form role="group"> it doesn't look as it should

Current Behavior

image

Vue 3 code:

<template>
  <main class="container">
    <form role="group">
      <label>
        Calculator
        <input type="text" placeholder="0" v-model="userInput" />
        <input type="button" value="=" @click="calculate" />
      </label>
    </form>
  </main>
</template>

Expected Behavior

It's supposed to look something like this but with a label:
image

Reproduction URL

https://codepen.io/ASOwnerYT/pen/VwERGRP

Environment

Chrome 113.0.5672.127 (32-bit)
Windows 10

@pattnaik-soumitri
Copy link

I am also facing thiss issue on Pico v1.x.y.

@lucaslarroche
Copy link
Member

@ASOwnerYT, @pattnaik-soumitri,
You could use legend:

<form>
  <fieldset>
    <legend>Subscribe to our newsletter</legend>
    <div role="group">
      <input name="email" type="email" placeholder="Enter your email" autocomplete="email" />
      <input type="submit" value="Subscribe" />
    </div>
  </fieldset>
</form>

@stuartmaxwell
Copy link

Looks like the grouping needs to be done on the parent element of the input tags. The solution is to use a div to group the input boxes.

<form>
  <label>
    Label
    <div role="group">
      <input type="text" placeholder="0" v-model="userInput" />
      <input type="button" value="=" @click="calculate" />
    </div>
  </label>
</form>

Tested and working on v2.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants