-
Notifications
You must be signed in to change notification settings - Fork 532
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
Better accessibility #74
Comments
Good idea. |
Some tool: https://github.com/addyosmani/a11y/ |
I have experience in this area and have started work on this. As I'm fairly new to Vue, I wanted to validate my approach before I go to much further. I started with labels: LabelsAssociate with ControlTo make labels accessible, you need to associate them with 'their' control. The best way to do this is to use a <label for="first-name">First Name</label>
<input id="first-name" ... /> This means that we need an getFieldID(schema) {
if (typeof schema.id !== 'undefined') {
// If an ID's been explicitly set, use it unchanged
return schema.id
} else {
// Try to get a reasonable default id from the schema, then slugify it.
return (schema.inputName || schema.label || schema.model)
.toString()
.trim()
.toLowerCase()
// Spaces to dashes
.replace(/ /g, '-')
// Multiple dashes to one
.replace(/-{2,}/g, '-')
// Remove leading & trailing dashes
.replace(/^-+|-+$/g, '')
// Remove anything that isn't a (English/ASCII) letter or number.
.replace(/([^a-zA-Z0-9\._-]+)/g, '')
;
}
} This can then be used in every <template lang="jade">
.wrapper
input.form-control(
:id="getFieldID(schema)",
:type="schema.inputType",
... Then, in label(v-if="fieldTypeHasLabel(field)", :for="getFieldID(field)")
| {{ field.label }} Don't output labels for buttonsI also noticed that labels were being output for buttons, which isn't the correct thing to do. I added a fieldTypeHasLabel(field) {
switch (field.type) {
case 'button':
case 'submit':
return false;
default:
return true;
}
}, This is all working fine for me locally, using the test/dev app. I'll push a fork/branch tomorrow and link it here - but in the meantime - does this sound like the correct way to go about these changes - and should I carry on? |
You could simplify this by setting the input's But I think you'd want to add a form-level prefix to the inputs You could leave this all to the user - and make them fill in a |
@dflock Thanks your suggestion. I think it is good way. Please make a PR and I will test it. |
What is the status on this? @dflock ? |
Just about freed myself up to start working on this again. Hope to have an updated version of #105 pushed by this evening. |
After that, I want to work on sorting out the current |
Some resources : http://inclusive-components.club/toggle-button/ |
Closed by #201 |
Let's not forget about this, the web is for everybody.
I don't have experience with this, it could be nice to have someone who know about these stuff on board to help.
We could start with labels.
Documentation and information:
The text was updated successfully, but these errors were encountered: