skills/pixijs-accessibility/SKILL.md
Use this skill when adding screen reader and keyboard navigation to PixiJS v8 apps. Covers AccessibilitySystem options (enabledByDefault, debug, activateOnTab, deactivateOnMouseMove), per-container accessibility properties, shadow DOM overlay, mobile touch-hook activation. Triggers on: accessibility, a11y, screen reader, ARIA, keyboard navigation, tab order, AccessibilitySystem, accessibleTitle, accessibleHint, tabIndex, accessibleChildren.
npx skillsauth add pixijs/pixijs-skills pixijs-accessibilityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enable screen reader and keyboard navigation via PixiJS's AccessibilitySystem. The system creates an invisible shadow DOM overlay positioned over accessible containers so assistive technology can discover and activate them.
const button = new Sprite(await Assets.load("button.png"));
button.accessible = true;
button.accessibleTitle = "Play game";
button.accessibleHint = "Starts a new game session";
button.eventMode = "static";
button.tabIndex = 0;
app.stage.addChild(button);
app.renderer.accessibility.setAccessibilityEnabled(true);
button.on("pointertap", () => startGame());
Related skills: pixijs-events (pointer/tap handlers), pixijs-scene-dom-container (HTML elements on canvas), pixijs-application (init options).
Key points:
enabledByDefault: true in Application init for immediate activation.import { Container, Sprite } from "pixi.js";
const container = new Container();
container.accessible = true;
container.accessibleTitle = "Navigation menu";
container.accessibleHint = "Contains links to other pages";
container.eventMode = "static"; // required for custom tabIndex to apply
container.tabIndex = 0;
container.accessibleType = "div"; // defaults to 'button'
const sprite = new Sprite();
sprite.accessible = true;
sprite.accessibleTitle = "Close dialog";
sprite.accessibleText = "X"; // text content of the shadow div
sprite.eventMode = "static";
sprite.tabIndex = 1;
Available properties on any Container:
accessible (boolean) - enables the accessible overlay divaccessibleTitle (string) - sets the title attribute on the shadow divaccessibleHint (string) - sets the aria-label attributeaccessibleText (string) - sets inner text content of the shadow divaccessibleType (string) - HTML tag for the shadow element, defaults to 'button'tabIndex (number) - tab order for keyboard navigation (only applied when interactive is true / eventMode is 'static' or 'dynamic')accessibleChildren (boolean, default true) - when false, prevents child containers from being accessibleaccessiblePointerEvents (string) - CSS pointer-events value on the shadow divGive each accessible container a tabIndex to control the order assistive tech walks through them. Higher numbers come later; equal numbers fall back to scene-graph order.
menuButton.accessible = true;
menuButton.eventMode = "static";
menuButton.tabIndex = 1;
playButton.accessible = true;
playButton.eventMode = "static";
playButton.tabIndex = 2;
settingsButton.accessible = true;
settingsButton.eventMode = "static";
settingsButton.tabIndex = 3;
tabIndex is only forwarded to the shadow div when the container is interactive (eventMode is 'static' or 'dynamic'). Without that, the system clamps the div's tabIndex back to 0, and the order you set is ignored.
import { Application } from "pixi.js";
const app = new Application();
await app.init({ width: 800, height: 600 });
// Enable accessibility at runtime
app.renderer.accessibility.setAccessibilityEnabled(true);
// Check current state
console.log(app.renderer.accessibility.isActive);
console.log(app.renderer.accessibility.isMobileAccessibility);
// Full init options:
await app.init({
accessibilityOptions: {
enabledByDefault: true, // activate immediately (default: false)
debug: true, // makes overlay divs visible (default: false)
activateOnTab: true, // Tab key activates system (default: true)
deactivateOnMouseMove: false, // stay active when mouse moves (default: true)
},
});
The system can also be configured via static defaults before creating the Application:
import { AccessibilitySystem, Application } from "pixi.js";
AccessibilitySystem.defaultOptions.enabledByDefault = true;
AccessibilitySystem.defaultOptions.deactivateOnMouseMove = false;
const app = new Application();
await app.init();
import { Sprite } from "pixi.js";
const button = new Sprite();
button.eventMode = "static";
button.accessible = true;
button.accessibleTitle = "Submit form";
button.tabIndex = 0;
// Screen readers trigger click/tap events through the shadow DOM element
button.on("pointertap", () => {
submitForm();
});
When accessibility is active and a user activates a shadow div (via Enter/Space key or screen reader action), the system dispatches click, pointertap, and tap FederatedEvents to the corresponding container. Focus on the shadow div dispatches mouseover, and focus-out dispatches mouseout. Both eventMode and accessible should be set for full keyboard + pointer support.
The AccessibilitySystem does not create its DOM overlay until the user presses Tab (or, on mobile, focuses the touch hook). If your application needs accessibility immediately:
const app = new Application();
await app.init({
accessibilityOptions: {
enabledByDefault: true,
},
});
Or at runtime:
app.renderer.accessibility.setAccessibilityEnabled(true);
Without one of these, automated accessibility testing tools will not find the overlay elements.
Wrong:
const sprite = new Sprite();
sprite.accessible = true;
// no title or hint set
Correct:
const sprite = new Sprite();
sprite.accessible = true;
sprite.accessibleTitle = "Play button";
sprite.accessibleHint = "Click to start the game";
A container with accessible = true but no accessibleTitle or accessibleHint gets a fallback title of "container {tabIndex}". Screen readers will announce this generic label with no useful context. Always provide at least accessibleTitle.
By default, deactivateOnMouseMove is true. Any mouse movement after Tab-activation will deactivate the overlay. This is by design (assumes keyboard-only users don't use a mouse), but it makes testing with a mouse frustrating.
await app.init({
accessibilityOptions: {
deactivateOnMouseMove: false,
},
});
When using skipExtensionImports: true for a custom build, the accessibility extension is not automatically registered. You must import it explicitly:
import "pixi.js/accessibility";
import { Application } from "pixi.js";
const app = new Application();
await app.init({ skipExtensionImports: true });
Without this import, app.renderer.accessibility will be undefined and no shadow DOM layer will be created.
development
Use this skill when rendering live HTML/DOM elements (or frozen snapshots of them) as PixiJS v8 textures via the EXPERIMENTAL HTML-in-Canvas browser APIs. Covers the pixi.js/html-source side-effect import, feature-detection with canvas.requestPaint, HTMLSource for a live, repainting element kept interactive in the browser (autoLayout/autoUpdate/autoRequestPaint, requestPaint, isReady, the direct-child-of-canvas + layoutsubtree requirement), ElementImageSource for an immutable captureElementImage() snapshot (autoClose, ready immediately), using the source on a Sprite/Texture/Mesh, fallback-only auto-detection via Texture.from at priority -10, and destroy/cleanup. Triggers on: HTMLSource, ElementImageSource, pixi.js/html-source, requestPaint, captureElementImage, ElementImage, layoutsubtree, autoRequestPaint, autoUpdate, autoClose, HTML in canvas, render DOM to texture, HTMLSourceOptions, ElementImageSourceOptions, HTMLSourceCanvas, experimental.
development
Use this skill first for ANY PixiJS v8 task; it routes to the right specialized skill for the job. Covers the full PixiJS surface: Application setup, the scene graph (Container, Sprite, Graphics, Text, Mesh, ParticleContainer, DOMContainer, GifSprite), rendering (WebGL/WebGPU/Canvas, render loop, custom shaders, filters, blend modes), assets, events, color, math, ticker, accessibility, performance, environments, migration from v7, and project scaffolding. Triggers on: pixi, pixi.js, pixijs, PixiJS, v8, Application, app.init, Sprite, Container, Graphics, Text, Mesh, ParticleContainer, DOMContainer, GifSprite, Assets, Ticker, renderer, WebGL, WebGPU, scene graph, filter, shader, blend mode, texture, BitmapText, create-pixi, how do I draw, how do I render, how do I animate in pixi.
development
Use this skill when rendering text in PixiJS v8. Covers Text for canvas-quality styled labels, BitmapText for cheap per-frame updates via glyph atlas, HTMLText for HTML/CSS markup via SVG, SplitText and SplitBitmapText for per-character animation, TextStyle, tagStyles, constructor options, TextOptions, HTMLTextOptions, BitmapText, SplitTextOptions, SplitBitmapTextOptions. Triggers on: Text, BitmapText, HTMLText, SplitText, SplitBitmapText, TextStyle, HTMLTextStyle, BitmapFont.install, tagStyles, fontFamily, wordWrap.
data-ai
Use this skill when rendering thousands of lightweight sprites in PixiJS v8. Covers ParticleContainer with Particle instances, addParticle/removeParticle, particleChildren array, dynamicProperties (vertex, position, rotation, uvs, color), boundsArea, roundPixels, update. Triggers on: ParticleContainer, Particle, IParticle, addParticle, particleChildren, dynamicProperties, boundsArea, particle effects, constructor options, ParticleContainerOptions, ParticleOptions.