@guidepup/virtual-screen-reader
Advanced tools
Comparing version 0.10.0 to 0.11.0
import { jumpToControlledElement } from "./jumpToControlledElement"; | ||
import { jumpToDetailsElement } from "./jumpToDetailsElement"; | ||
import { moveToNextAlternateReadingOrderElement } from "./moveToNextAlternateReadingOrderElement"; | ||
import { moveToPreviousAlternateReadingOrderElement } from "./moveToPreviousAlternateReadingOrderElement"; | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role banner. | ||
* | ||
* REF: https://w3c.github.io/aria/#banner | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role complementary. | ||
* | ||
* REF: https://w3c.github.io/aria/#complementary | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role contentinfo. | ||
* | ||
* REF: https://w3c.github.io/aria/#contentinfo | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* figures. | ||
* | ||
* REF: https://w3c.github.io/aria/#figure | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role form. | ||
* | ||
* REF: https://w3c.github.io/aria/#form | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* landmark regions. | ||
* | ||
* REF: https://w3c.github.io/aria/#landmark | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role main. | ||
* | ||
* REF: https://w3c.github.io/aria/#main | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role navigation. | ||
* | ||
* REF: https://w3c.github.io/aria/#navigation | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role region. | ||
* | ||
* REF: https://w3c.github.io/aria/#region | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role search. | ||
* | ||
* REF: https://w3c.github.io/aria/#search | ||
*/ | ||
import { VirtualCommandArgs } from "./types"; | ||
export declare const commands: { | ||
moveToNextLandmark: ({ currentIndex, tree }: import("./getNextIndexByRole").GetNextIndexByRoleArgs) => number; | ||
moveToPreviousLandmark: ({ currentIndex, tree, }: import("./getPreviousIndexByRole").GetPreviousIndexByRoleArgs) => number; | ||
moveToNextSearch: (args: VirtualCommandArgs) => number | null; | ||
moveToNextFigure: (args: VirtualCommandArgs) => number | null; | ||
moveToNextForm: (args: VirtualCommandArgs) => number | null; | ||
moveToNextMain: (args: VirtualCommandArgs) => number | null; | ||
moveToNextRegion: (args: VirtualCommandArgs) => number | null; | ||
moveToNextBanner: (args: VirtualCommandArgs) => number | null; | ||
moveToNextComplementary: (args: VirtualCommandArgs) => number | null; | ||
moveToNextContentinfo: (args: VirtualCommandArgs) => number | null; | ||
moveToNextNavigation: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousSearch: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousFigure: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousForm: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousMain: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousRegion: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousBanner: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousComplementary: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousContentinfo: (args: VirtualCommandArgs) => number | null; | ||
moveToPreviousNavigation: (args: VirtualCommandArgs) => number | null; | ||
jumpToControlledElement: typeof jumpToControlledElement; | ||
jumpToDetailsElement: typeof jumpToDetailsElement; | ||
moveToNextAlternateReadingOrderElement: typeof moveToNextAlternateReadingOrderElement; | ||
moveToPreviousAlternateReadingOrderElement: typeof moveToPreviousAlternateReadingOrderElement; | ||
}; | ||
export type VirtualCommands = typeof commands; | ||
export type VirtualCommands = { | ||
[K in keyof typeof commands]: (typeof commands)[K]; | ||
}; | ||
export type VirtualCommandKey = keyof VirtualCommands; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.commands = void 0; | ||
const getNextIndexByRole_1 = require("./getNextIndexByRole"); | ||
const getPreviousIndexByRole_1 = require("./getPreviousIndexByRole"); | ||
const jumpToControlledElement_1 = require("./jumpToControlledElement"); | ||
const jumpToDetailsElement_1 = require("./jumpToDetailsElement"); | ||
const moveToNextAlternateReadingOrderElement_1 = require("./moveToNextAlternateReadingOrderElement"); | ||
const moveToPreviousAlternateReadingOrderElement_1 = require("./moveToPreviousAlternateReadingOrderElement"); | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role banner. | ||
* | ||
* REF: https://w3c.github.io/aria/#banner | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role complementary. | ||
* | ||
* REF: https://w3c.github.io/aria/#complementary | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role contentinfo. | ||
* | ||
* REF: https://w3c.github.io/aria/#contentinfo | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* figures. | ||
* | ||
* REF: https://w3c.github.io/aria/#figure | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role form. | ||
* | ||
* REF: https://w3c.github.io/aria/#form | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* landmark regions. | ||
* | ||
* REF: https://w3c.github.io/aria/#landmark | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role main. | ||
* | ||
* REF: https://w3c.github.io/aria/#main | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role navigation. | ||
* | ||
* REF: https://w3c.github.io/aria/#navigation | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role region. | ||
* | ||
* REF: https://w3c.github.io/aria/#region | ||
*/ | ||
/** | ||
* TODO: Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role search. | ||
* | ||
* REF: https://w3c.github.io/aria/#search | ||
*/ | ||
const quickLandmarkNavigationRoles = [ | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role banner. | ||
* | ||
* REF: https://w3c.github.io/aria/#banner | ||
*/ | ||
"banner", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role complementary. | ||
* | ||
* REF: https://w3c.github.io/aria/#complementary | ||
*/ | ||
"complementary", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role contentinfo. | ||
* | ||
* REF: https://w3c.github.io/aria/#contentinfo | ||
*/ | ||
"contentinfo", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* figures. | ||
* | ||
* REF: https://w3c.github.io/aria/#figure | ||
*/ | ||
"figure", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role form. | ||
* | ||
* REF: https://w3c.github.io/aria/#form | ||
*/ | ||
"form", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role main. | ||
* | ||
* REF: https://w3c.github.io/aria/#main | ||
*/ | ||
"main", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role navigation. | ||
* | ||
* REF: https://w3c.github.io/aria/#navigation | ||
*/ | ||
"navigation", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role region. | ||
* | ||
* REF: https://w3c.github.io/aria/#region | ||
*/ | ||
"region", | ||
/** | ||
* Assistive technologies SHOULD enable users to quickly navigate to | ||
* elements with role search. | ||
* | ||
* REF: https://w3c.github.io/aria/#search | ||
*/ | ||
"search", | ||
]; | ||
const quickLandmarkNavigationCommands = quickLandmarkNavigationRoles.reduce((accumulatedCommands, role) => { | ||
const moveToNextCommand = `moveToNext${role.at(0).toUpperCase()}${role.slice(1)}`; | ||
const moveToPreviousCommand = `moveToPrevious${role | ||
.at(0) | ||
.toUpperCase()}${role.slice(1)}`; | ||
return { | ||
...accumulatedCommands, | ||
[moveToNextCommand]: (0, getNextIndexByRole_1.getNextIndexByRole)([role]), | ||
[moveToPreviousCommand]: (0, getPreviousIndexByRole_1.getPreviousIndexByRole)([role]), | ||
}; | ||
}, {}); | ||
exports.commands = { | ||
jumpToControlledElement: jumpToControlledElement_1.jumpToControlledElement, | ||
jumpToDetailsElement: jumpToDetailsElement_1.jumpToDetailsElement, | ||
moveToNextAlternateReadingOrderElement: moveToNextAlternateReadingOrderElement_1.moveToNextAlternateReadingOrderElement, | ||
moveToPreviousAlternateReadingOrderElement: moveToPreviousAlternateReadingOrderElement_1.moveToPreviousAlternateReadingOrderElement, | ||
...quickLandmarkNavigationCommands, | ||
moveToNextLandmark: (0, getNextIndexByRole_1.getNextIndexByRole)(quickLandmarkNavigationRoles), | ||
moveToPreviousLandmark: (0, getPreviousIndexByRole_1.getPreviousIndexByRole)(quickLandmarkNavigationRoles), | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.jumpToControlledElement = void 0; | ||
const moveToNextIdRefElement_1 = require("./moveToNextIdRefElement"); | ||
const getNextIndexByIdRefsAttribute_1 = require("./getNextIndexByIdRefsAttribute"); | ||
/** | ||
@@ -22,3 +22,3 @@ * aria-controls: | ||
function jumpToControlledElement({ index = 0, container, currentIndex, tree, }) { | ||
return (0, moveToNextIdRefElement_1.moveToNextIdRefElement)({ | ||
return (0, getNextIndexByIdRefsAttribute_1.getNextIndexByIdRefsAttribute)({ | ||
attributeName: "aria-controls", | ||
@@ -25,0 +25,0 @@ index, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.moveToNextAlternateReadingOrderElement = void 0; | ||
const moveToNextIdRefElement_1 = require("./moveToNextIdRefElement"); | ||
const getNextIndexByIdRefsAttribute_1 = require("./getNextIndexByIdRefsAttribute"); | ||
/** | ||
@@ -30,3 +30,3 @@ * aria-flowto: | ||
function moveToNextAlternateReadingOrderElement({ index, container, currentIndex, tree, }) { | ||
return (0, moveToNextIdRefElement_1.moveToNextIdRefElement)({ | ||
return (0, getNextIndexByIdRefsAttribute_1.getNextIndexByIdRefsAttribute)({ | ||
attributeName: "aria-flowto", | ||
@@ -33,0 +33,0 @@ index, |
@@ -55,3 +55,3 @@ "use strict"; | ||
"aria-description": null, | ||
"aria-details": null, | ||
"aria-details": idRefs("linked details", "linked details", false), | ||
"aria-disabled": state(State.DISABLED), | ||
@@ -129,3 +129,3 @@ "aria-dropeffect": null, | ||
} | ||
function idRefs(propertyDescriptionSuffixSingular, propertyDescriptionSuffixPlural) { | ||
function idRefs(propertyDescriptionSuffixSingular, propertyDescriptionSuffixPlural, printCount = true) { | ||
return function mapper({ attributeValue, container }) { | ||
@@ -139,3 +139,3 @@ const idRefsCount = attributeValue | ||
} | ||
return `${idRefsCount} ${idRefsCount === 1 | ||
return `${printCount ? `${idRefsCount} ` : ""}${idRefsCount === 1 | ||
? propertyDescriptionSuffixSingular | ||
@@ -142,0 +142,0 @@ : propertyDescriptionSuffixPlural}`; |
@@ -29,3 +29,24 @@ import { CommandOptions, ScreenReader } from "@guidepup/guidepup"; | ||
get commands(): { | ||
moveToNextSearch: "moveToNextSearch"; | ||
moveToNextFigure: "moveToNextFigure"; | ||
moveToNextForm: "moveToNextForm"; | ||
moveToNextMain: "moveToNextMain"; | ||
moveToNextRegion: "moveToNextRegion"; | ||
moveToNextBanner: "moveToNextBanner"; | ||
moveToNextComplementary: "moveToNextComplementary"; | ||
moveToNextContentinfo: "moveToNextContentinfo"; | ||
moveToNextNavigation: "moveToNextNavigation"; | ||
moveToPreviousSearch: "moveToPreviousSearch"; | ||
moveToPreviousFigure: "moveToPreviousFigure"; | ||
moveToPreviousForm: "moveToPreviousForm"; | ||
moveToPreviousMain: "moveToPreviousMain"; | ||
moveToPreviousRegion: "moveToPreviousRegion"; | ||
moveToPreviousBanner: "moveToPreviousBanner"; | ||
moveToPreviousComplementary: "moveToPreviousComplementary"; | ||
moveToPreviousContentinfo: "moveToPreviousContentinfo"; | ||
moveToPreviousNavigation: "moveToPreviousNavigation"; | ||
moveToNextLandmark: "moveToNextLandmark"; | ||
moveToPreviousLandmark: "moveToPreviousLandmark"; | ||
jumpToControlledElement: "jumpToControlledElement"; | ||
jumpToDetailsElement: "jumpToDetailsElement"; | ||
moveToNextAlternateReadingOrderElement: "moveToNextAlternateReadingOrderElement"; | ||
@@ -32,0 +53,0 @@ moveToPreviousAlternateReadingOrderElement: "moveToPreviousAlternateReadingOrderElement"; |
{ | ||
"name": "@guidepup/virtual-screen-reader", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "Virtual screen reader driver for unit test automation.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
96834
67
2303