Coder Social home page Coder Social logo

Comments (8)

messenjer avatar messenjer commented on June 9, 2024 1

Yes, it's not that simple. In VeeValidate, they do something similar with the Form, Field, ErrorMessage Components. It's a bit too magical for me.

The developer has written an article on the subject: https://logaretm.com/blog/making-the-most-out-of-vuejs-injections/

from oruga.

messenjer avatar messenjer commented on June 9, 2024 1

I tested with the new version 0.8.8 and it works. Thanks

from oruga.

messenjer avatar messenjer commented on June 9, 2024

The use of 'aria-labelledby' breaks also the use of getByLabel('Firstname')

In v0.7, it's working

<div class="field" placeholder="First Name" type="text">
  <label 
     for="firstname"
     class="label"
    ><div class="is-inline-flex is-align-items-center">
      First Name <span class="is-required">*</span>
    </div>
    </label
  >
  <div class="control">
    <input
      placeholder="First Name"
      name="firstname"
      id="firstname"
      class="input"
      type="text"
      autocomplete="off"
    />
  </div>
</div>

In 0.8, its not working

<div class="field" placeholder="First Name" type="text">
  <label 
     for="firstname"
     class="label"
    ><div class="is-inline-flex is-align-items-center">
      First Name <span class="is-required">*</span>
    </div>
    </label
  >
  <div class="control">
    <input
      placeholder="First Name"
      name="firstname"
      id="firstname"
      class="input"
      type="text"
      autocomplete="off"
      aria-labelledby="5usgluoiyzy"
    />
  </div>
</div>

from oruga.

mlmoravek avatar mlmoravek commented on June 9, 2024

Yeah the uuid() default of ariaLabelledby needs to be removed. I like the idea of injecting the id used for o-field into the o-input component. But with the posibility to override it with a directly passed prop to o-input.

from oruga.

messenjer avatar messenjer commented on June 9, 2024

Like this ?

without labelFor attribute in o-field

    <o-field label="Name">
        <o-input model-value="Kevin Garvey" />
    </o-field>

Generates:

<div data-oruga="field" class="field">
  <label
       class="label"
+       for="9kht9axc5v4"
   >Name</label>
  <div data-oruga="input" class="control">
    <input
      data-oruga-input="text"
      type="text"
      class="input"
      autocomplete="off"
+      id="9kht9axc5v4"
    />
  </div>
</div>

With labelFor attribute in o-field

    <o-field label="Name" label-for="name">
        <o-input model-value="Kevin Garvey" id="name" />
    </o-field>

Generates

<div data-oruga="field" class="field">
  <label class="label"
+       for="name"
   >Name</label>
  <div data-oruga="input" class="control">
    <input
      data-oruga-input="text"
      type="text"
      class="input"
      autocomplete="off"
+      id="name"
    />
  </div>
</div>

from oruga.

mlmoravek avatar mlmoravek commented on June 9, 2024

@Messenger yes, something like that. I just need to figure out whether the o-field should define the id and pass it down, or the input below should define the id and pass it up to the o-field...

from oruga.

mlmoravek avatar mlmoravek commented on June 9, 2024

However, I see the strength of Oruga more in the features of the other components. For proper form components with validation and so on I suggest FormKit.

from oruga.

mlmoravek avatar mlmoravek commented on June 9, 2024

@messenjer Wow, thank you so much for the article, it is very interesting!

from oruga.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.