@testing-library/dom version: 7.21.6<label for="rating-test-2">2 Stars</label>
<input id="rating-test-test" type="radio" />
getByLabelText('2 Stars')
Found a label with the text of: 2 Stars, however the element associated with this label (<input />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <input />, you can use aria-label or aria-labelledby instead.
HTMLInputElement.labels is not supported in IE 11 or prior to Firefox 56
Use CSS selector. It's even used later in the code and it's not clear why we use two different approaches.
Dang it. 馃槄
Dang it.
dom-accessibility-api didn't support native labels either in these environments. Polyfilling this is actually quite involved: https://github.com/eps1lon/dom-accessibility-api/pull/352/files
Though that fix also targets Edge 17. If you just target Edge 18 and IE 11 you can leverage HTMLLabelElement.control which simplifies things by a lot.
That actually doesn't look all that bad. Thanks for sharing! We could just put that code at the bottom of the label query module or in a helpers file and if we can't access things by .label we could use that as a fallback.
Anyone wanna work on this? It's possible this could also be useful as another module and both our libraries could consume I guess.
I'd like to work on this one, but unfortunately, I'm not totally clear about how this one should be fixed. Some help is appreciated!
I'd like to work on this one, but unfortunately, I'm not totally clear about how this one should be fixed. Some help is appreciated!
@BatuhanW Apologies, I didn't mean to step on your toes with my PR! I'd started this a few days ago, so just thought I'd go for it. Happy to discuss if you'd find it helpful 馃檪
@BatuhanW, I'm sure there will be another opportunity to contribute in the future :) Watch the repo and you can be notified when there's an opportunity :) We'd love to have your contribution!
:tada: This issue has been resolved in version 7.21.8 :tada:
The release is available on:
npm package (@latest dist-tag)Your semantic-release bot :package::rocket:
Most helpful comment
Dang it. 馃槄