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

plotly-a11y-enhancer

v1.0.4

Published

The plotly treemap does not come with the built-in accessibility feature and keyboard accessibility. This package adds the keyboard navigation on angular plotly treemap along with the content recognition by screen reader (tested on NVDA).

Downloads

13

Readme

Angular Plotly Treemap Accessibility

The plotly treemap does not come with the built-in accessibility feature and keyboard accessibility. This package adds the keyboard navigation on angular plotly treemap along with the content recognition by screen reader (tested on NVDA).

Plotly is a very powerful charting tool created on top of d3.js. But due to lack of the accessibility many application can not use even if it is free.

Since we needed accessibility on plotly treemap, A small package has been created which adds accessibility and keyboard navigation. Works well with screen reader. Tooltip can be dismissed by ESC key. On next ESC key the focus is set out side of the graph. So that you dont need to go through each cell when data is large.

Dependency

This package adds keyboard navigation and other accessibility feature to angular plotly treemap. It has following dependency

How to add accessibility and keyboard navigation to plotly treemap

Install the package npm i plotly-a11y-enhancer

Import the TreemapInteractionService into your component where treemap is added

import { TreemapInteractionService } from 'plotly-a11y-enhancer';

Now add DI for TreemapInteractionService in your component.

constructor( private _interactionService: TreemapInteractionService,)

This service exposes two methods:

  • addKeyboardInteractions(treemapSelector: string)

  • cleanUpListeners()

The HTML part:


<plotly-plot

[data]="graph.data"

[layout]="graph.layout"

[config]="graph.config"

(afterPlot)="heatmapLoaded()">

</plotly-plot>

Once treemap is loaded it calls the heatmapLoadedcallback.

Please add below code inside that function:


heatmapLoaded() {

this._interactionService.addKeyboardInteractions('plotly-plot');

}

And you are done.

Note: Make sure to call cleanUpListeners in ngOnDestroy to avoid any memory leaks.


ngOnDestroy() {

this._interactionService.cleanUpListeners(); // Note: This is important otherwise there will be memory leaks

}

Working demo

Please click below stackblitz link. It may take a few seconds to render as plotly is little heavy.

https://stackblitz.com/edit/stackblitz-starters-1vvg9f?file=src%2Fmain.ts