npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

accessifyhtml5

v2.0.0

Published

While most browsers work all right with the new semantic elements of HTML5, they dont add the ARIA accessibility attributes that the specification demands. This small JavaScript adds those attributes to enhance accessibility of web sites.

Downloads

3

Readme

accessifyhtml5.js

The polyfill for a more accessible HTML5.

Which problem is solved with this polyfill?

While most browsers work all right with the new semantic elements of HTML5, they don’t add the ARIA accessibility attributes that the specification demands. This small JavaScript adds those attributes to enhance accessibility of web sites.

How to use accessifyhtml5.js?

Just link to the accessifyhtml5.js file and call the AccessifyHTML5-Function at the bottom of your page right before the closing </body> tag:

<script src="accessifyhtml5.js"></script>
<script>AccessifyHTML5();</script>

There are some options you’re able to specify as they can be on each web page only once.

  • header: A CSS selector that selects exactly one element on the page which will get the role banner.
  • footer: A CSS selector that selects exactly one element on the page which will get the role contentinfo.
  • main: A CSS selector that selects exactly one element on the page which will get the role main.

Example:

<script src="accessifyhtml5.js"></script>
<script>
	AccessifyHTML5({
		header:"body>header",
		footer:"body>footer",
		main: "#main"
	});
</script>

jQuery

Important: From today on, 2013-03-27, the jQuery version of accessifyhtml5.js is deprecated. Use the vanilla JS version instead. (You can just replace the jQuery version with the non-jQuery JS file.)

<script src="accessifyhtml5.jquery.js"></script>
<script>AccessifyHTML5();</script>

CDN

I’ve created a small CDN that should serve the JS file quite fast. I recommend to use the code here and copy it to the bottom of your project’s HTML file. Code:

<script src="//yatil-cdn.s3.amazonaws.com/accessifyhtml5.min.js"></script>
<script>AccessifyHTML5();</script>

Changelog

Version 2.0

  • Release date: 27-Mar-2013
  • Thanks to @nfreear for adding tests and HTML4 element support. Really a great extension.
  • The jQuery version is now deprecated.
  • The CDN version got updated, the jQuery version was replaced by the non-jQuery version. (They share the same API, so there shouldn’t be a problem here.)

Version 1.5

  • Release date: 19-Feb-2013
  • Added support for the standard <main> element as specified by the W3C. If you specify your own element for the main role, I reset the main role for the <main> element. (There can’t be more than one element with the role main.)

Version 1.0

  • Release date: 05-Feb-2012
  • Added support for specifying the main part of the web site using the main parameter (as requested by @yellowled).
  • The script won’t overwrite your specified roles.

Version 1.0 beta

  • Release date: 15-Aug-2011
  • Added non-jQuery version (Using querySelector, adds support in IE8+, FF3.5+, Opera 10+, Safari, Chrome as well as iOS, Android and Opera Mobile)
  • Removed header.site getting role banner and footer.site getting role contentinfo -> If you need to add a class, you can also add the role directly to the HTML
  • Thanks to @adickson you can just add selectors for banner and contentinfo when calling the function
  • You’ll now have to call AccessifyHTML5-function like that: AccessifyHTML5({header:"#header", footer:"#footer"});

Acknowledgements:

Known Issues:

  • According to @jkiss, Window-Eyes 7.11 struggles with aria-roles and HTML5, this is nothing I can solve with this script but is a screen reader issue. See: https://twitter.com/jkiss/status/5488643711967232
  • Firefox adds roles by itself, so this script is not needed for those browsers. I haven’t found a way to detect if those implicit roles are set, so I can’t test that at the moment.

License:

This project is MIT licensed.

Author:

  • Eric Eggert
  • Twitter: @yatil
  • Blog: http://yatil.net
  • Workshops: http://modernwebaccessibility.com