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

fr-bypasslinks

v1.0.5

Published

Frend's accessible, modern bypass link component.

Downloads

56

Readme


permalink: /components/bypasslinks/ filename: bypasslinks title: Bypass links description: Bypass links blurb. This will pulled into both homepage and component page. alpha: false sources:

  • title: HTML url: https://github.com/frend/frend.co/blob/gh-pages/_components/bypasslinks/bypasslinks.html
  • title: CSS url: https://github.com/frend/frend.co/blob/gh-pages/_components/bypasslinks/bypasslinks.css
  • title: JS url: https://github.com/frend/frend.co/blob/gh-pages/_components/bypasslinks/bypasslinks.js links:
  • title: WebAIM - "Skip Navigation" Links url: http://webaim.org/techniques/skipnav/
  • title: Nicholas C. Zakas - Fixing “Skip to content” links url: https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
  • title: Penn State Accessibility - Skip Navigation url: http://accessibility.psu.edu/skipnav/
  • title: W3C - Bypass blocks url: https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-skip.html
  • title: W3C - Using ARIA landmarks to identify regions of a page url: https://www.w3.org/WAI/GL/wiki/Using_ARIA_landmarks_to_identify_regions_of_a_page

Having a simple set of bypass links available, provides users the ability to bypass blocks of content that are repeated over multiple web pages. Useful for screen-readers and keyboard users, bypass links are visibly hidden until focused via the tab key, when they appear at the top of the viewport. These can be used in conjunction with proper ARIA landmarks, as a keyboard-friendly option.

We can smooth out browser inconsistency in shifting focus to target elements (see Fixing “Skip to content” links) by adding tabindex="-1" to non-focusable targets. This has recently been fixed in Chrome, but Safari and older versions of Internet Explorer will require the additional attributes.

The JavaScript part of this component is optional as the important functionality can be achieved with the correct HTML & CSS. The usability of the links can be improved however, removing the tabindex once the user has tabbed past the target element will not allow the user to unintentionally apply focus to a target element e.g. on click or tabbing through the document.

Install

Frbypasslinks is available to install with npm. Run with the --save flag to add the component your project dependencies.

npm install fr-bypasslinks --save

The component will then be available to import.

import Frbypasslinks from 'fr-bypasslinks';

Functional styles for the bypass links (bypasslinks.css) that are required to display the component states correctly should be referenced via a <link> in the <head> of your document, or can be integrated into your existing stylesheet.

You can read more about installing Frend components on our About page, including details on the functional CSS and JavaScript structure.

Usage

<ul class="js-fr-bypasslinks">
	<li>
		<a href="#main-content">Skip to main content</a>
	</li>
</ul>
<main id="main-content" tabindex="-1">
	...
</main>

Assign the function invocation to a variable.

var myBypasslinks = Frbypasslinks();

Methods

// remove all bindings and attributes when no longer needed
myBypasslinks.destroy();

// re-initialise as needed
myBypasslinks.init();

Options

var myBypasslinks = Frbypasslinks({
	// String - Container selector, hook for JS init() method
	selector: '.js-fr-bypasslinks'
});