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

Optimization (accessibility): Lists do not contain only <li> elements and script supporting elements #4187

Closed
rfultz opened this issue Nov 5, 2020 · 1 comment · Fixed by #4434

Comments

@rfultz
Copy link
Contributor

rfultz commented Nov 5, 2020

Background

Looking to optimize the site's performance and that of the homepage specifically, the Lighthouse tool in Chromium browsers has made some suggestions. Some of these will have repercussions throughout the app so we're going to make them their own tickets.

Accessibility Recommendation: Lists do not contain only <li> elements and script supporting elements

Screen readers have a specific way of announcing lists. Ensuring proper list structure aids screen reader output. details

Overview

<ul> are not supposed to have <div> as children.

Benefit (the 80 of 80/20)

Will help screen readers and search engines read the page

Effort (the 20 of 80/20)

Minimal for this page
Moderate if other pages are affected

Complications

  • Is there a reason we have a UL with children that are both DIV and UL? Are both <ul><div> and <ul><ul> breaking the rules? Any reason the parent <ul> shouldn't be a <div>?
  • Are we doing something like this anywhere else on the site?

Related tickets

This was referenced Nov 5, 2020
@rfultz rfultz self-assigned this Mar 1, 2021
@rfultz
Copy link
Contributor Author

rfultz commented Mar 1, 2021

Valid child elements for <ul> are <li>, <script>, and <template> (mdn). (<li> content can be anything.)

I can't find a way to easily scour the site looking for <ul> children that aren't <li>—no easy way to querySelectorAll('ul > li:not')—but spot checking the 300+ instances of <ul, it doesn't seem to be a widespread issue.

There's an instance inside fec/legal/templates/legal-advisory-option.jinja that I've corrected and there's another issue in fec/fec/static/js/data/terms.json where the html is inside a string (three occurrences on line 28)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant