Open santhoshreddyk opened 2 years ago
… on html elements? jsx has a spec.
No directly on html elements, its custom react components provided a library. Custom react control has inner html elements and for them we pass the aria attributes as props of outer element. Example:
<SideBySideImages
firstImageAlt="First Iamge"
secndImageAlt="Second Image"
firstImageSrc="/somesrc.jpg"
secondImageSrc="othersrc.jpg"
/>
Here i have a flexibility of inferring the custom Control name i guess but not custom attributes?
What rules are checking prop names on custom components?
Well, in this case we are checking 'alt' property for image indirectly. The html that would be generated by above custom component is
<div><img src="/somesrc.jpg" alt="First Image"/><img src="/othersrc.jpg" alt="Second Image"/></div>
by checking the "firstImageAlt" on custom component, i will be able to check the 'alt' rule on inner 'img' element. What i am looking for is, i should be able to let the plugin know that 'SideBySideImage' is of type 'img' and 'firstImageAlt' is equals to 'alt' attribute.
Something similar to this. https://www.npmjs.com/package/eslint-plugin-react
Here custom components and attributes are declared in settings json
Exactly looking for this https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/174
I am using a react library (fluent-ui library) where the aria attribute names are different, is it possible to declare my own aria attributes Example:
aria-labeledby is spelled as ariaLabeledBy