@a11y-pulse/disclosure-operability-audit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,80 @@
1
+ export type DisclosureKey = "Enter" | "Space";
2
+ /** What put a changed trigger back as it was found. */
3
+ export type DisclosureRestore = DisclosureKey | "Escape" | "click" | "blur";
4
+ export type DisclosureAttempt = {
5
+ key: DisclosureKey;
6
+ /** `aria-expanded` before and after the key press. */
7
+ expandedBefore: string | null;
8
+ expandedAfter: string | null;
9
+ /** Whether content was shown or hidden: an `aria-controls` target, or anything else on the page. */
10
+ contentChanged: boolean;
11
+ /** What undid the change, or null when nothing changed or nothing undid it. */
12
+ restoredBy: DisclosureRestore | null;
13
+ };
14
+ export type DisclosureSignal =
15
+ /** Fails: it works with a pointer but cannot take keyboard focus (WCAG 2.1.1). */
16
+ "not-focusable"
17
+ /** Fails: it works with a pointer but neither Enter nor Space does anything (WCAG 2.1.1). */
18
+ | "keyboard-inoperable"
19
+ /** Fails: a key shows or hides content but `aria-expanded` is missing or never changes (WCAG 4.1.2). */
20
+ | "state-not-exposed"
21
+ /** Review: nothing the audit tried, keyboard or pointer, changed anything. */
22
+ | "unresponsive"
23
+ /** Review: `aria-expanded` changes but no content was seen to appear or disappear. */
24
+ | "state-without-content"
25
+ /** Review: Enter works but Space does not, on a button. */
26
+ | "space-inoperable"
27
+ /** Review: Space works but Enter does not. */
28
+ | "enter-inoperable"
29
+ /** Review: it opens with a key but only a click closes it again. */
30
+ | "pointer-only-close"
31
+ /**
32
+ * Review: once opened, nothing the audit could safely try closed it. The page was left changed.
33
+ * What opened may have kept focus to itself, in which case only Escape was pressed.
34
+ */
35
+ | "not-restored"
36
+ /** Review: operating it tried to submit a form, which the audit stopped. */
37
+ | "submit-blocked"
38
+ /** Review: operating it tried to load another page, which the audit stopped. */
39
+ | "navigation-blocked"
40
+ /** Review: content appears when the trigger takes focus, without `aria-expanded` changing. */
41
+ | "opens-on-focus"
42
+ /** Review: the trigger left the document when operated. */
43
+ | "trigger-removed"
44
+ /** Review: it has a negative `tabindex` and is not part of a widget that manages focus. */
45
+ | "not-in-tab-order"
46
+ /** Review: operating it replaced the document, and the audit stopped. */
47
+ | "navigated";
48
+ export type Verdict = "failed" | "review" | null;
49
+ export type DisclosureObservation = {
50
+ /** Whether the trigger took focus. */
51
+ focusable: boolean;
52
+ inTabOrder: boolean;
53
+ inComposite: boolean;
54
+ spaceExpected: boolean;
55
+ /** Set when taking focus alone changed the trigger or the page. */
56
+ openedOnFocus: {
57
+ expandedChanged: boolean;
58
+ } | null;
59
+ attempts: readonly DisclosureAttempt[];
60
+ /** Whether a click or a hover changed anything. Null when not tried. */
61
+ pointer: {
62
+ click: boolean | null;
63
+ hover: boolean | null;
64
+ };
65
+ /** Whether operating it tried to submit a form or leave the page, and was stopped. */
66
+ blocked: {
67
+ submit: boolean;
68
+ navigation: boolean;
69
+ };
70
+ removed: boolean;
71
+ navigated: boolean;
72
+ /** False when the trigger could not be put back as it was found. */
73
+ restored: boolean;
74
+ };
75
+ export type DisclosureClassification = {
76
+ verdict: Verdict;
77
+ signals: DisclosureSignal[];
78
+ };
79
+ /** Decide what the keys pressed on one trigger, and what they changed, say about it. */
80
+ export declare function classifyTrigger(observation: DisclosureObservation): DisclosureClassification;
@@ -0,0 +1,7 @@
1
+ export type { BrowserAdaptor, ElementRef } from "@a11y-pulse/browser-adaptor";
2
+ export type { DisclosureOperabilityOptions } from "./audit";
3
+ export { DEFAULT_ACTIVATION_TIMEOUT_MS, DEFAULT_RISKY_NAME_PATTERN, DEFAULT_TRIGGER_LIMIT, runDisclosureOperabilityAudit, } from "./audit";
4
+ export type { DisclosureSkipReason } from "./browser-scripts";
5
+ export type { DisclosureAttempt, DisclosureClassification, DisclosureKey, DisclosureObservation, DisclosureRestore, DisclosureSignal, Verdict, } from "./classify";
6
+ export { classifyTrigger } from "./classify";
7
+ export type { DisclosureOperabilityResult, DisclosureSkipped, DisclosureTrigger, } from "./result";