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

aria-autopilot

v0.0.1

Published

Declarative accessibility control

Downloads

1

Readme

Aria Autopilot, Declarative accessibility

License: MIT npm version Donate with PayPal

Aria Autopilot binds interactive behavior based on declarative rules.

It exposes a set of instructions often used when building interactive widgets.

Aria Autopilot is currently a work in progress

We can bind ARIA attributes using data-aria-autopilot attribute, Aria Autopilot will then automatically apply the attributes when loaded. Aria Autopilot uses MutationObserver to automatically expand attributes defined on dynamically inserted DOM elements.

Time to learn ES6?

Aria Autopilot is written in ES6.

If you want to learn how to write modern ES6 JavaScript as well, I highly recommend ES6 for Everyone by Wes Bos.

Installation

It's best if Aria Autopilot runs as quickly as possible after loading the DOM. If you put the script reference in the <head> and add a defer attribute to it the browser will load the script in parralel with your HTML and will automatically execute it once the DOM is ready.

<!doctype html>
<html>
  <head>
    <title>Aria Autopilot</title>
    <script defer src="aria-autopilot.min.js"></script>
  </head>
  <body>

  </body>
</html>

Configuration

Instruction format

An @event happens, a relation is found, a sequence of actions is run.

@event: relation -> action
@event: relation -> action, action
@event: relation(parameter, paremeter, ...) -> action; relation -> action, action

Available events

| Event | Description | |-----------------|-----------------------------------| | activate | Triggered on click or return key pressed | | expand | Triggered when the aria-expanded attribute is switched to "true" | | collapse | Triggered when the aria-expanded attribute is switched to "false" | | press | Triggered when the aria-pressed attribute is switched to "true" | | release | Triggered when the aria-pressed attribute is switched to "false" | | select | Triggered when the aria-selected attribute is switched to "true" | | deselect | Triggered when the aria-selected attribute is switched to "false" | | target | Triggered when the element is the target of the location hash | | key_up | Triggered on key up pressed | | key_down | Triggered on key down pressed | | key_left | Triggered on key left pressed | | key_right | Triggered on key right pressed | | key_escape | Triggered on escape key pressed | | key_enter | Triggered on enter key pressed | | key_space | Triggered on spacebar pressed | | key_tab | Triggered on tab key pressed | | key_backspace | Triggered on backspace pressed | | key_code | Triggered on key press with given code |

Available relations

| Relation | Description | |---------------------------------------------------|--------------------------------------| | origin(childSelector) | the first element referencing this element | | target(childSelector) | the element targetted by this element via href, aria-controls or if both are missing the next sibling | | context(childSelector) | the current element | | siblings(childSelector, parentSelector) | the siblings of this element | | next-sibling(childSelector, parentSelector) | the next sibling of this element | | previous-sibling(childSelector, parentSelector) | the previous sibling of this element | | last-sibling(childSelector, parentSelector) | the last sibling of this element | | first-sibling(childSelector, parentSelector) | the first sibling of this element |

Available actions

| Action | Description | |------------------------|-----------------| | select | Sets the aria-selected attribute to "true" and fires the select event | | deselect | Sets the aria-selected attribute to "false" and fires the deselect event | | press | Sets the aria-pressed attribute to "true" and fires the press event | | release | Sets the aria-pressed attribute to "false" and fires the release event | | expand | Sets the aria-expanded attribute to "true" and fires the expand event | | collapse | Sets the aria-expanded attribute to "false" and fires the collapse event | | toggle | Toggles the aria state on the element and fires the related event | | activate | Sets the aria state on the element to "true" and fires the related event | | deactivate | Sets the aria state on the element to "false" and fires the related event | | focus | Moves focus to the selected element | | show | Sets the hidden attribute to "false" on the element | | hide | Sets the hidden attribute to "true" on the element | | show-target | show the target element (the element reference by href, aria-controls or the next sibling) | | hide-target | hide the target element (the element reference by href, aria-controls or the next sibling) | | set-focusable | Sets the tabindex of the element to "0" allowing user focus | | set-script-focusable | Sets the tabindex of the element to "-1" allowing script focus | | update-location | Update window location hash with element id

Versioning

Versioning follows Semver.

License

MIT