pico icon indicating copy to clipboard operation
pico copied to clipboard

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

Open ASOwnerYT opened this issue 2 years ago • 3 comments
trafficstars

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

ASOwnerYT avatar May 26 '23 00:05 ASOwnerYT

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

pattnaik-soumitri avatar Jun 22 '23 19:06 pattnaik-soumitri

@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>

lucaslarroche avatar Feb 18 '24 05:02 lucaslarroche

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

stuartmaxwell avatar Jun 16 '24 22:06 stuartmaxwell