Skip to content
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

Associate label and input tags together via for and id attributes for accessibility #6

Open
adamjohnson opened this issue Aug 16, 2021 · 0 comments

Comments

@adamjohnson
Copy link

In the complete example, the Search and Show inputs have labels, but they are not programmatically associated with their inputs via for and id attributes.

Right now the markup is like this:

<label class="label">Search</label>
...
<input class="input" type="text" placeholder="Start typing..." x-model="params.search" @keyup.debounce.350="doSearch()">

In order to associate the <label> with the <input>, for and id attributes need to be applied:

<label for="littleBigTable-search" class="label">Search</label>
...
<input id="littleBigTable-search" class="input" type="text" placeholder="Start typing..." x-model="params.search" @keyup.debounce.350="doSearch()">

Here's a great article on how to create accessible forms and another site with many examples of accessible form markup.

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

No branches or pull requests

1 participant