18f.gsa.gov icon indicating copy to clipboard operation
18f.gsa.gov copied to clipboard

Third-party script embeds cause automated accessibility scan failures.

Open adunkman opened this issue 2 years ago • 3 comments

Now that we’re nearing completion for automated accessibility scans (#3605), a few errors have popped up due to pages which are loading scripts from third-party domains and modifying the site.

Twitter embeds use <iframe> elements which do not have a title attribute.

There appears to be a race condition, sometimes the title attribute is added and sometimes it is not.

Errors in http://localhost:4000/site/2016/05/10/gsa-invests-in-18fs-work-with-new-service/:

 • Iframe element requires a non-empty title attribute that identifies the
   frame.

   (#rufous-sandbox)

   <iframe id="rufous-sandbox" scrolling="no" frameborder="0"
   allowtransparency="true" allowfullscreen="true" style="position: absolute;
   visibility: hidden; display: none; width: 0px; height: 0px; padding: 0px;
   border: none;"></iframe>

Pages which use embedded tweets:

Instagram embeds use <iframe> elements which do not have a title attribute.

Instagram embeds do not have title attributes.

Errors in http://localhost:4000/site/2016/01/21/what-we-can-learn-from-the-interiors-social-feeds/:

 • Iframe element requires a non-empty title attribute that identifies the
   frame.

   (#instagram-embed-0)

   <iframe class="instagram-media instagram-media-rendered"
   id="instagram-embed-0"
   src="[https://www.instagram.com/p/_-fx45Au4w/embed/?cr=1&amp;v=6&amp;wp=617&amp;rd=http%3A%2F%2Flocalhost%3A4000&amp;rp=%2Fsite%2F2016%2F01%2F21%2Fwhat-we-can-learn-from-t](https://www.instagram.com/p/_-fx45Au4w/embed/?cr=1&v=6&wp=617&rd=http%3A%2F%2Flocalhost%3A4000&rp=%2Fsite%2F2016%2F01%2F21%2Fwhat-we-can-learn-from-t)...

Pages which use embedded Instagram posts:

Speakerdeck embeds use <iframe> elements which do not have a title attribute.

Speakerdeck embeds do not have title attributes.

Errors in http://localhost:4000/site/2014/05/14/hacking-bureaucracy-improving-hiring-and-software/:

 • Iframe element requires a non-empty title attribute that identifies the
   frame.

   (#talk_frame_99582)

   <iframe id="talk_frame_99582" class="speakerdeck-iframe"
   src="//speakerdeck.com/player/5604c360b9ea01313bb0227341532047" width="710"
   height="532" style="aspect-ratio:710/532; border:0; padding:0; margin:0;
   background:transparent;" frameborder="0" all...

Pages which use embedded Speakerdeck decks:

Netlify CMS fails color contrast checks.

There are additional accessibility issues documented in https://github.com/netlify/netlify-cms/issues/1333.

Errors in http://localhost:4000/site/admin/#/:

 • A title should be provided for the document, using a non-empty title element
   in the head section.

   (html > head)

   <head><style type="text/css"> .upload...</head>

 • This element has insufficient contrast at this conformance level. Expected a
   contrast ratio of at least 4.5:1, but text in this element has a contrast
   ratio of 3.41:1. Recommendation:  change text colour to #00050e.

   (html > body)

   <body>--- <meta charset="utf-8...</body>

Pages which use Netlify CMS:

References:

Expected Behavior

All pages on our site should pass automated accessibility scans as well as manual testing.

Actual Behavior

Pages are not passing automated accessibility scans.

adunkman avatar Aug 16 '22 16:08 adunkman

There is a few angles worth considering when using third party script embeds:

  • The data we are giving over to third party services, which may be employing user tracking for advertisement purposes.
  • The endorsement we may be making of a third party service or a person.
  • The maintenance cost of updating references to third party content when they change, including if a user marks their tweets as protected.
  • The access we are giving third party services to run scripts and modify content within our website.

adunkman avatar Aug 16 '22 16:08 adunkman

Additional considerations:

  • Some people browse with third party domains blocked. The content will be missing for them.
  • The content may be deleted or may be changed in a variety of ways: the content author wishing to remove it; a malicious user defacing the content; a technological error on the part of the third party hosting the content, etc.

I'd propose updating the example blog post with a policy like:

If the content you want to embed is static (like a tweet or picture) and is either in the public domain or your use falls under fair use, take a screenshot. Use that. Ensure the alt text fully describes the content. Credit the content creator and include a descriptive link back to the original source. [example here]

If the content is interactive, include a descriptive link to the content and (optional) a preview screenshot. If you include a screenshot, ensure the alt text appropriately describes the image. [example here]

As for the existing violations, it would be good to fix them, but if nobody has bandwidth right now, I think it is more important to stop future accessibility issues from happening. The existing ones could be marked as false positives to silence the scanner.

SSPJ avatar Aug 17 '22 13:08 SSPJ

I took the false-positive approach in https://github.com/18F/18f.gsa.gov/commit/f08ad520ef0d80a78e856ca60a04ace9a6d9d472 and excluded the pages with third-party related pa11y errors from pa11y scanning. I agree that "it is more important to stop future accessibility issues from happening".

neilmb avatar Aug 17 '22 15:08 neilmb

The PR for this fix needs an Engineer to review.

To the future Engineer reviewing this: With @mgwalker rolling off DA Team, there is no active engineer owning this now. So if additional fixes are needed please make them yourself OR note those fixes here for a future engineer staffed to DA.

colinmurphy01 avatar Mar 17 '23 17:03 colinmurphy01