Open
Description
openedon Apr 6, 2020
Problem
#20699 introduced createInterpolateElement()
, but using it with anchor tags triggers the jsx-a11y/anchor-has-content
rule. e.g.,
createInterpolateElement(
__( 'There was an error trying to render this content, please try another browser or device. If that doesn\'t work, please <a>contact us</a>.', 'wordcamporg' ),
{
a: <a href={ 'https://central.wordcamp.org/contact-us/' } />,
}
);
> npm run lint:js source/utils/render-frontend.js
...
63:9 error Anchors must have content and the content must be accessible by a screen reader jsx-a11y/anchor-has-content
Potential solutions
I'm not seeing any great solutions at first glance.
- Disable the linter rule
- Replace it with a custom rule that is aware of
createInterpolateElement()
- Refactor
createInterpolateElement()
to avoid triggering the rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes)./packages/eslint-plugin/packages/eslint-plugin/packages/element/packages/elementTracking issues with work in progressTracking issues with work in progressA suggestion for improvement.A suggestion for improvement.