Giter Club home page Giter Club logo

Comments (6)

shankarsridhar avatar shankarsridhar commented on July 20, 2024 2

Hello @raycohen 😃
I am also running into the same issue in my applications, and I find it more less than ideal and, more like a workaround to be adding data-* attributes to the parent and referring the child element(i.e. radio-button).

I'll be happy to send a PR for adding this enhancement. I was thinking of adding a new property, say dataAttributes which accepts an hash of data-* key/value pairs, which gets added to the radio buttons' dom - just like the other attributes that is being done currently, like ariaLabelledby, tabindex, etc

from ember-radio-button.

alexlafroscia avatar alexlafroscia commented on July 20, 2024 1

What would really be nice is if the components supported attribute forwarding (AKA splattributes, ...attributes in the template).

Depending on the Ember version support matrix and the tolerance for either providing or requiring a polyfill, that would allow you to add whatever attribute you want to a <RadioButton /> component and have the attributes passed along to the underlying input.

from ember-radio-button.

raycohen avatar raycohen commented on July 20, 2024

We don't currently have a good way to support data-test attributes directly on the input element. I would recommend putting a data-test attribute on an ancestor and then using something like [data-test-my-ancestor] input[type=radio]

from ember-radio-button.

barryofguilder avatar barryofguilder commented on July 20, 2024

I would love to see support for data-* attributes on this!

from ember-radio-button.

allthesignals avatar allthesignals commented on July 20, 2024

What would really be nice is if the components supported attribute forwarding (AKA splattributes, ...attributes in the template).

Depending on the Ember version support matrix and the tolerance for either providing or requiring a polyfill, that would allow you to add whatever attribute you want to a <RadioButton /> component and have the attributes passed along to the underlying input.

Hmm know any addons that use this kind of polyfill? I'm running into this and would like to submit a PR.

I'd try out a local workaround, but it doesn't sound like this is extensible.

Never mind — if you're using modern Ember (support splattributes), you can generate a component override for radio-button.js/.hbs. You'll need to copy over the template from the addon and insert the attribute spread in the label:

  <label
    class="ember-radio-button {{if checked checkedClass}} {{joinedClassNames}}"
    for={{radioId}}
    ...attributes
  >

Nevertheless, we should build out support :)

from ember-radio-button.

lougreenwood avatar lougreenwood commented on July 20, 2024

Any progress on this? Seems it's not possible to apply a modifier to the radio button

from ember-radio-button.

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.