-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Abide accessibility #10699
Abide accessibility #10699
Conversation
Set aria-invalid attribute when something is not valid, see [here (Mailinglist)](http://lists.w3.org/Archives/Public/public-pfwg/2015Jul/0031.html) and [here (Spec)](https://www.w3.org/TR/wai-aria-1.1/#aria-invalid).
Added aria-onerrormessage attributes where needed. See [here (Spec)](https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage). Fixed multiple elements having the same ID.
@Owlbertz Normally I'd love to, but I'm drowning in work at the moment, so it might be 2–3 weeks (at least) before I can get round to looking properly at it. So for the moment the best I can do is thank you for your hard work. ;-) |
@udf2457 any update, would be great for a disabled user to know when there are validation errors |
@atainton Don't hesitate to check this out and give feedback on your own . |
@atainton et al. I'm afraid I'm currently a bit backlogged at work - more backlogged than I was in October, which apparently is somehow humanly possible ! So realistically I'm not going to be able to do much testing of the above commit until much before the end of the year. Sorry to disappoint, but such is life ! |
I'll check this. I want to learn about accessibility and this is a good opportunity for that ;) |
@ncoden glad to hear that. |
Changes: * rename IDs of inputs/descriptors * add `aria-describedby` and `aria-live="assertive` when required
@Owlbertz I added some aria attributes to the docs and tested it. It works well ;). I am particulary impressed by the The next step is to add these attributes when we can. I'm thinking to What do you think ? |
Add Abide option: `globalErrorAriaLevel`
|
Prevent jQuery `.filter()` to mutate the context object.
Poke @Owlbertz. Would you have some time to review this ? :) |
…or v6.5.0 51a2558 Implemented accessibility for Abide. dfae510 Improved accessibility of Abide page. 3e512b9 Added unittests for aria-invalid in Abide. 835cf04 docs: improve accessibility of abide examples 07b2d76 feat: add [aria-live] on [data-abide-error] on form validation 88abca7 feat: automatically add [aria-describedby] and [for] attributes in Abide d1acd32 feat: add `a11yAttributes` option on Abide to disable a11y attribute insertion f55efd5 feat: set `[aria-live]` on Abide global erros on init 6cf6619 docs: add basic doc about a11y attributes in Abide 32efbc2 test: add unit tests for Abide.addA11yAttributes() 8e7fa06 test: add unit test for Abide.addGlobalErrorA11yAttributes() edf21d2 test: add visual test for Abide accessibility c6a6906 fix: fix side-effect of jQuery .filter() in Abide.addA11yAttributes c6e4b56 feat: add [role=label] to all form errors in Abide Co-Authored-By: Nicolas Coden <nicolas@ncoden.fr> Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
I don't know if @ncoden is still around but I would be interested in why you decided to add the This causes the screen reader to announce the error element event before the user has done anything wrong. I created a quick sample here what happens (try it out with a screen reader): The screen reader is announcing here the following:
We received feedback from accessibility auditors that this can be confusing for users using the assistive technologies. The user would not expect the error text to describe the contents of the input field. Instead, the screen reader should announce the error only when it becomes visible on the page, i.e. when the user leaves the field without entering anything to it (or when they return back to the field after first leaving it empty). If there is a valid reason why you added the The described current behavior would be completely fine in case it happened when the error was already visible on the page, i.e. when the user returns back to the field after they first left it empty. But now that they hear the error description when it is still invisible on the screen, it creates confusion. Could you share some insight on this? Here's the example code if it disappears for some reason from JSFiddle: <!DOCTYPE html>
<html>
<head>
<title>Foundation test</title>
<!-- Compressed CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/css/foundation.min.css" crossorigin="anonymous">
<!-- Compressed JavaScript -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/js/foundation.min.js" crossorigin="anonymous"></script>
</head>
<body>
<form data-abide novalidate data-abide="true" data-validate-on-blur="true" data-live-validate="true">
<label>
Text Required
<input type="text" placeholder="Go to this field with a screenreader (don't type anything)" required>
<span class="form-error">
Yo, you had better fill this out, it's required.
</span>
</label>
</form>
<script>
$(document).ready(() => {
$("body").foundation();
});
</script>
</body>
</html> |
Improved Abide accessibility, based on issue #10552.
As this PR will not create a full WCAG compliance, it is at least a step towards it.
Maybe @udf2457 could give some feedback.