Skip to content

Add labelComponents option to form control has label #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 18, 2022

Conversation

gavmck
Copy link
Contributor

@gavmck gavmck commented Nov 12, 2021

We have custom label components in our app which means the form-control-has-label rule is always triggered.

I've leant on the options setup for label-has-for and implemented a similar setup where you can pass an array of custom components to be considered as label elements by the rule for validation.

In the app template:

<CustomLabel for="myInput">Label</CustomLabel>
<input type="text" id="myInput" />

Pass the label components as part of the ruleset:

"vuejs-accessibility/form-control-has-label": [
      "error",
      {
        "labelComponents": ["CustomLabel"],
      }
    ]

Copy link
Collaborator

@vhoyer vhoyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but i don't see tests for this feature on the diff, could you add them?

Another thing, I think we will need to ask the maintainer about this, but I think you don't need to update te version on this PR 🤔

@gavmck
Copy link
Contributor Author

gavmck commented Nov 15, 2021

Correct me if I'm wrong, but i don't see tests for this feature on the diff, could you add them?

Another thing, I think we will need to ask the maintainer about this, but I think you don't need to update te version on this PR 🤔

Ah I missed the tests folder! Updated.

Copy link
Collaborator

@vhoyer vhoyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, wdyt @kddnewton ?

@gavmck
Copy link
Contributor Author

gavmck commented Feb 22, 2022

Any update on this? Still throwing warnings all over the shop in our app.

@gavmck
Copy link
Contributor Author

gavmck commented May 12, 2022

Fixed the conflicts, reckon this can get merged in?

@shaunkrd
Copy link

Nice addition 👍🏼 Would be great to see this added 🙏

@vhoyer vhoyer merged commit 7a1ee63 into vue-a11y:main May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants