Test your skills: CSS and JavaScript accessibility
The aim of this skill test is to assess whether you've understood our CSS and JavaScript accessibility best practices article.
Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks.
If you get stuck, then ask us for help — see the Assessment or further help section at the bottom of this page.
CSS accessibility 1
In the first task you are presented with a list of links. However, their accessibility is pretty bad — there is no way to really tell that they are links, or to tell which one the user is focussed on.
We'd like you to assume that the existing ruleset with the a
selector is supplied by some CMS, and that you can't change it — instead, you need to create new rules to make the links look and behave like links, and for the user to be able to tell where they are in the list.
Try updating the live code below to recreate the finished example:
Download the starting point for this task to work in your own editor or in an online editor.
CSS accessibility 2
In this next task you are presented with a simple bit of content — just headings and paragraphs. There are accessibility issues with the colors and sizing of the text; we'd like you to:
- Explain what the problems are, and what the guidelines are that state the acceptable values for color and sizing.
- Select new values for the color and font-size that fix the problem.
- Update the CSS with these new values to fix the problem.
- Test the code to make sure the problem is now fixed. Explain what tools or methods you used to select the new values and test the code.
Try updating the live code below to recreate the finished example:
Download the starting point for this task to work in your own editor or in an online editor.
JavaScript accessibility 1
In our final task here, you have some JavaScripting to do. We have a simple app that presents a list of animal names. Clicking one of the animal names causes a further description of that animal to appear in a box below the list.
But it is not very accessible — in its current state you can only operate it with the mouse. We'd like you to add to the HTML and JavaScript to make it keyboard accessible too.
Download the starting point for this task to work in your own editor or in an online editor.
Assessment or further help
You can practice these examples in the Interactive Editors above.
If you would like your work assessed, or are stuck and want to ask for help:
- Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections.
- Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include:
- A descriptive title such as "Assessment wanted for CSS accessibility 1 skill test".
- Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment.
- A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code.
- A link to the actual task or assessment page, so we can find the question you want help with.