@atom63/ui-foundation 0.2.0-beta.6 → 0.2.0-beta.7
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.
- package/dist/a11y/index.js +3 -0
- package/dist/a11y/index.js.map +1 -0
- package/dist/axes.js +3 -0
- package/dist/axes.js.map +1 -0
- package/dist/chunk-2DAT6SHN.js +16 -0
- package/dist/chunk-2DAT6SHN.js.map +1 -0
- package/dist/chunk-2WET3R4I.js +31 -0
- package/dist/chunk-2WET3R4I.js.map +1 -0
- package/dist/chunk-3L7CCXFC.js +23 -0
- package/dist/chunk-3L7CCXFC.js.map +1 -0
- package/dist/chunk-3Q3N3XVB.js +27 -0
- package/dist/chunk-3Q3N3XVB.js.map +1 -0
- package/dist/chunk-3ZDR5WEP.js +1088 -0
- package/dist/chunk-3ZDR5WEP.js.map +1 -0
- package/dist/chunk-46LPKTCR.js +37 -0
- package/dist/chunk-46LPKTCR.js.map +1 -0
- package/dist/chunk-4R77TT6O.js +35 -0
- package/dist/chunk-4R77TT6O.js.map +1 -0
- package/dist/chunk-5NPMVJQ3.js +27 -0
- package/dist/chunk-5NPMVJQ3.js.map +1 -0
- package/dist/chunk-5UWJ4VK2.js +13 -0
- package/dist/chunk-5UWJ4VK2.js.map +1 -0
- package/dist/chunk-5YEQFLJ4.js +294 -0
- package/dist/chunk-5YEQFLJ4.js.map +1 -0
- package/dist/chunk-65UMT45O.js +86 -0
- package/dist/chunk-65UMT45O.js.map +1 -0
- package/dist/chunk-6NKIGJAI.js +17 -0
- package/dist/chunk-6NKIGJAI.js.map +1 -0
- package/dist/chunk-6VM565IP.js +20 -0
- package/dist/chunk-6VM565IP.js.map +1 -0
- package/dist/chunk-72RJUJWS.js +24 -0
- package/dist/chunk-72RJUJWS.js.map +1 -0
- package/dist/chunk-7DQ5JOWH.js +42 -0
- package/dist/chunk-7DQ5JOWH.js.map +1 -0
- package/dist/chunk-7JTUON5I.js +18 -0
- package/dist/chunk-7JTUON5I.js.map +1 -0
- package/dist/chunk-7KPYYQZW.js +72 -0
- package/dist/chunk-7KPYYQZW.js.map +1 -0
- package/dist/chunk-7RQS66MZ.js +31 -0
- package/dist/chunk-7RQS66MZ.js.map +1 -0
- package/dist/chunk-AC7OTXMN.js +19 -0
- package/dist/chunk-AC7OTXMN.js.map +1 -0
- package/dist/chunk-B76DKHNA.js +13 -0
- package/dist/chunk-B76DKHNA.js.map +1 -0
- package/dist/chunk-BLJQQKX3.js +13 -0
- package/dist/chunk-BLJQQKX3.js.map +1 -0
- package/dist/chunk-BTLPH7FI.js +47 -0
- package/dist/chunk-BTLPH7FI.js.map +1 -0
- package/dist/chunk-CHGRTBOS.js +20 -0
- package/dist/chunk-CHGRTBOS.js.map +1 -0
- package/dist/chunk-CP5DC323.js +42 -0
- package/dist/chunk-CP5DC323.js.map +1 -0
- package/dist/chunk-CQHJDZ7B.js +20 -0
- package/dist/chunk-CQHJDZ7B.js.map +1 -0
- package/dist/chunk-D5DRRDHN.js +28 -0
- package/dist/chunk-D5DRRDHN.js.map +1 -0
- package/dist/chunk-DD56ZLIO.js +23 -0
- package/dist/chunk-DD56ZLIO.js.map +1 -0
- package/dist/chunk-DNI22FZ5.js +26 -0
- package/dist/chunk-DNI22FZ5.js.map +1 -0
- package/dist/chunk-DSVNAHHE.js +22 -0
- package/dist/chunk-DSVNAHHE.js.map +1 -0
- package/dist/chunk-DYN6LBOR.js +28 -0
- package/dist/chunk-DYN6LBOR.js.map +1 -0
- package/dist/chunk-E4AWSJAR.js +42 -0
- package/dist/chunk-E4AWSJAR.js.map +1 -0
- package/dist/chunk-EF3TFN44.js +3 -0
- package/dist/chunk-EF3TFN44.js.map +1 -0
- package/dist/chunk-ELW2VEJ2.js +24 -0
- package/dist/chunk-ELW2VEJ2.js.map +1 -0
- package/dist/chunk-FLUWE5GD.js +29 -0
- package/dist/chunk-FLUWE5GD.js.map +1 -0
- package/dist/chunk-FYXJAQNO.js +20 -0
- package/dist/chunk-FYXJAQNO.js.map +1 -0
- package/dist/chunk-H6OLGUAK.js +19 -0
- package/dist/chunk-H6OLGUAK.js.map +1 -0
- package/dist/chunk-H7K7FAPS.js +19 -0
- package/dist/chunk-H7K7FAPS.js.map +1 -0
- package/dist/chunk-HEUYWBMF.js +13 -0
- package/dist/chunk-HEUYWBMF.js.map +1 -0
- package/dist/chunk-IDYSL2FG.js +32 -0
- package/dist/chunk-IDYSL2FG.js.map +1 -0
- package/dist/chunk-IKRMPZVV.js +51 -0
- package/dist/chunk-IKRMPZVV.js.map +1 -0
- package/dist/chunk-IN2Y6XV3.js +45 -0
- package/dist/chunk-IN2Y6XV3.js.map +1 -0
- package/dist/chunk-IWC24CM2.js +17 -0
- package/dist/chunk-IWC24CM2.js.map +1 -0
- package/dist/chunk-JMIA4UWF.js +36 -0
- package/dist/chunk-JMIA4UWF.js.map +1 -0
- package/dist/chunk-JUB3LPZY.js +46 -0
- package/dist/chunk-JUB3LPZY.js.map +1 -0
- package/dist/chunk-JVEEVL2V.js +44 -0
- package/dist/chunk-JVEEVL2V.js.map +1 -0
- package/dist/chunk-KEPODUI6.js +76 -0
- package/dist/chunk-KEPODUI6.js.map +1 -0
- package/dist/chunk-KYLXTTZO.js +16 -0
- package/dist/chunk-KYLXTTZO.js.map +1 -0
- package/dist/chunk-M7YVEOVJ.js +53 -0
- package/dist/chunk-M7YVEOVJ.js.map +1 -0
- package/dist/chunk-MOASMLLU.js +26 -0
- package/dist/chunk-MOASMLLU.js.map +1 -0
- package/dist/chunk-MOD5OJN7.js +31 -0
- package/dist/chunk-MOD5OJN7.js.map +1 -0
- package/dist/chunk-N7257CAT.js +18 -0
- package/dist/chunk-N7257CAT.js.map +1 -0
- package/dist/chunk-NJCVWXLO.js +37 -0
- package/dist/chunk-NJCVWXLO.js.map +1 -0
- package/dist/chunk-NSEZVKWJ.js +44 -0
- package/dist/chunk-NSEZVKWJ.js.map +1 -0
- package/dist/chunk-O5Y2NKBU.js +22 -0
- package/dist/chunk-O5Y2NKBU.js.map +1 -0
- package/dist/chunk-OPSAZLFA.js +25 -0
- package/dist/chunk-OPSAZLFA.js.map +1 -0
- package/dist/chunk-PAAAX5KZ.js +32 -0
- package/dist/chunk-PAAAX5KZ.js.map +1 -0
- package/dist/chunk-QEGBADDM.js +37 -0
- package/dist/chunk-QEGBADDM.js.map +1 -0
- package/dist/chunk-QGJSIMKP.js +20 -0
- package/dist/chunk-QGJSIMKP.js.map +1 -0
- package/dist/chunk-QRWRZPK7.js +35 -0
- package/dist/chunk-QRWRZPK7.js.map +1 -0
- package/dist/chunk-SEQBAVTO.js +33 -0
- package/dist/chunk-SEQBAVTO.js.map +1 -0
- package/dist/chunk-SI6E6MJ4.js +29 -0
- package/dist/chunk-SI6E6MJ4.js.map +1 -0
- package/dist/chunk-SKTQEV5E.js +33 -0
- package/dist/chunk-SKTQEV5E.js.map +1 -0
- package/dist/chunk-SSCSRB5X.js +17 -0
- package/dist/chunk-SSCSRB5X.js.map +1 -0
- package/dist/chunk-TDYUGH2R.js +31 -0
- package/dist/chunk-TDYUGH2R.js.map +1 -0
- package/dist/chunk-TRSZM3SL.js +13 -0
- package/dist/chunk-TRSZM3SL.js.map +1 -0
- package/dist/chunk-UHNX7GI4.js +66 -0
- package/dist/chunk-UHNX7GI4.js.map +1 -0
- package/dist/chunk-UWVGVDSL.js +28 -0
- package/dist/chunk-UWVGVDSL.js.map +1 -0
- package/dist/chunk-UYMYO4AF.js +20 -0
- package/dist/chunk-UYMYO4AF.js.map +1 -0
- package/dist/chunk-V2WGYVRP.js +44 -0
- package/dist/chunk-V2WGYVRP.js.map +1 -0
- package/dist/chunk-V7G3HRPI.js +149 -0
- package/dist/chunk-V7G3HRPI.js.map +1 -0
- package/dist/chunk-VQIK4NBJ.js +51 -0
- package/dist/chunk-VQIK4NBJ.js.map +1 -0
- package/dist/chunk-VR2KY2B2.js +23 -0
- package/dist/chunk-VR2KY2B2.js.map +1 -0
- package/dist/chunk-WKOUVKCN.js +34 -0
- package/dist/chunk-WKOUVKCN.js.map +1 -0
- package/dist/chunk-XGY4RUOC.js +23 -0
- package/dist/chunk-XGY4RUOC.js.map +1 -0
- package/dist/chunk-XHNF4DJX.js +44 -0
- package/dist/chunk-XHNF4DJX.js.map +1 -0
- package/dist/chunk-XLXGKZJO.js +27 -0
- package/dist/chunk-XLXGKZJO.js.map +1 -0
- package/dist/chunk-XX3RI35Q.js +44 -0
- package/dist/chunk-XX3RI35Q.js.map +1 -0
- package/dist/chunk-Y4V7OWL4.js +1445 -0
- package/dist/chunk-Y4V7OWL4.js.map +1 -0
- package/dist/chunk-YJ22VUJ7.js +26 -0
- package/dist/chunk-YJ22VUJ7.js.map +1 -0
- package/dist/chunk-YNXEPOKY.js +20 -0
- package/dist/chunk-YNXEPOKY.js.map +1 -0
- package/dist/chunk-Z2MKSS6D.js +36 -0
- package/dist/chunk-Z2MKSS6D.js.map +1 -0
- package/dist/chunk-Z6AUAWK3.js +37 -0
- package/dist/chunk-Z6AUAWK3.js.map +1 -0
- package/dist/chunk-Z74KMG65.js +35 -0
- package/dist/chunk-Z74KMG65.js.map +1 -0
- package/dist/chunk-Z7NOXPUC.js +41 -0
- package/dist/chunk-Z7NOXPUC.js.map +1 -0
- package/dist/chunk-ZF4KKGKC.js +38 -0
- package/dist/chunk-ZF4KKGKC.js.map +1 -0
- package/dist/components/accordion/index.js +3 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/alert/alert-contract.js +3 -0
- package/dist/components/alert/alert-contract.js.map +1 -0
- package/dist/components/alert-dialog/index.js +3 -0
- package/dist/components/alert-dialog/index.js.map +1 -0
- package/dist/components/amount/amount-contract.js +3 -0
- package/dist/components/amount/amount-contract.js.map +1 -0
- package/dist/components/animated-check/index.js +3 -0
- package/dist/components/animated-check/index.js.map +1 -0
- package/dist/components/app-view/app-view-contract.js +3 -0
- package/dist/components/app-view/app-view-contract.js.map +1 -0
- package/dist/components/autocomplete/index.js +3 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/badge-contract.js +3 -0
- package/dist/components/badge/badge-contract.js.map +1 -0
- package/dist/components/breadcrumb/index.js +3 -0
- package/dist/components/breadcrumb/index.js.map +1 -0
- package/dist/components/button/button-contract.js +3 -0
- package/dist/components/button/button-contract.js.map +1 -0
- package/dist/components/button-group/button-group-contract.js +3 -0
- package/dist/components/button-group/button-group-contract.js.map +1 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/card/card-contract.js +3 -0
- package/dist/components/card/card-contract.js.map +1 -0
- package/dist/components/carousel/index.js +3 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/chat-composer/chat-composer-contract.js +3 -0
- package/dist/components/chat-composer/chat-composer-contract.js.map +1 -0
- package/dist/components/chat-message/chat-message-contract.js +3 -0
- package/dist/components/chat-message/chat-message-contract.js.map +1 -0
- package/dist/components/chat-steps/chat-steps-contract.js +3 -0
- package/dist/components/chat-steps/chat-steps-contract.js.map +1 -0
- package/dist/components/chat-typing-indicator/chat-typing-indicator-contract.js +3 -0
- package/dist/components/chat-typing-indicator/chat-typing-indicator-contract.js.map +1 -0
- package/dist/components/checkbox/checkbox-contract.js +3 -0
- package/dist/components/checkbox/checkbox-contract.js.map +1 -0
- package/dist/components/collapsible/index.js +3 -0
- package/dist/components/collapsible/index.js.map +1 -0
- package/dist/components/command/index.js +3 -0
- package/dist/components/command/index.js.map +1 -0
- package/dist/components/connected-panel/index.js +3 -0
- package/dist/components/connected-panel/index.js.map +1 -0
- package/dist/components/context-menu/index.js +3 -0
- package/dist/components/context-menu/index.js.map +1 -0
- package/dist/components/copy-button/index.js +3 -0
- package/dist/components/copy-button/index.js.map +1 -0
- package/dist/components/destination-link/index.js +3 -0
- package/dist/components/destination-link/index.js.map +1 -0
- package/dist/components/dialog/index.js +3 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/drawer/index.js +3 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/dropdown-menu/index.js +3 -0
- package/dist/components/dropdown-menu/index.js.map +1 -0
- package/dist/components/empty/index.js +3 -0
- package/dist/components/empty/index.js.map +1 -0
- package/dist/components/feedback-state/feedback-state-contract.js +3 -0
- package/dist/components/feedback-state/feedback-state-contract.js.map +1 -0
- package/dist/components/field/index.js +3 -0
- package/dist/components/field/index.js.map +1 -0
- package/dist/components/form/index.js +3 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/frame/frame-contract.js +3 -0
- package/dist/components/frame/frame-contract.js.map +1 -0
- package/dist/components/frame/index.js +4 -0
- package/dist/components/frame/index.js.map +1 -0
- package/dist/components/hover-card/index.js +3 -0
- package/dist/components/hover-card/index.js.map +1 -0
- package/dist/components/input/input-contract.js +3 -0
- package/dist/components/input/input-contract.js.map +1 -0
- package/dist/components/input-otp/input-otp-contract.js +3 -0
- package/dist/components/input-otp/input-otp-contract.js.map +1 -0
- package/dist/components/item/item-contract.js +3 -0
- package/dist/components/item/item-contract.js.map +1 -0
- package/dist/components/kbd/kbd-contract.js +3 -0
- package/dist/components/kbd/kbd-contract.js.map +1 -0
- package/dist/components/label/label-contract.js +3 -0
- package/dist/components/label/label-contract.js.map +1 -0
- package/dist/components/load-more-trigger/load-more-trigger-contract.js +3 -0
- package/dist/components/load-more-trigger/load-more-trigger-contract.js.map +1 -0
- package/dist/components/marquee/marquee-contract.js +3 -0
- package/dist/components/marquee/marquee-contract.js.map +1 -0
- package/dist/components/menu/menu-contract.js +3 -0
- package/dist/components/menu/menu-contract.js.map +1 -0
- package/dist/components/menubar/menubar-contract.js +3 -0
- package/dist/components/menubar/menubar-contract.js.map +1 -0
- package/dist/components/message/message-contract.js +3 -0
- package/dist/components/message/message-contract.js.map +1 -0
- package/dist/components/navigation-menu/navigation-menu-contract.js +3 -0
- package/dist/components/navigation-menu/navigation-menu-contract.js.map +1 -0
- package/dist/components/pagination/pagination-contract.js +4 -0
- package/dist/components/pagination/pagination-contract.js.map +1 -0
- package/dist/components/panel-setting-button/panel-setting-button-contract.js +3 -0
- package/dist/components/panel-setting-button/panel-setting-button-contract.js.map +1 -0
- package/dist/components/popover/popover-contract.js +3 -0
- package/dist/components/popover/popover-contract.js.map +1 -0
- package/dist/components/portal-container/portal-container-contract.js +3 -0
- package/dist/components/portal-container/portal-container-contract.js.map +1 -0
- package/dist/components/preview-card/preview-card-contract.js +3 -0
- package/dist/components/preview-card/preview-card-contract.js.map +1 -0
- package/dist/components/progress/progress-contract.js +3 -0
- package/dist/components/progress/progress-contract.js.map +1 -0
- package/dist/components/progressive-blur/progressive-blur-contract.js +3 -0
- package/dist/components/progressive-blur/progressive-blur-contract.js.map +1 -0
- package/dist/components/radio/radio-contract.js +3 -0
- package/dist/components/radio/radio-contract.js.map +1 -0
- package/dist/components/rating/rating-contract.js +3 -0
- package/dist/components/rating/rating-contract.js.map +1 -0
- package/dist/components/resizable/index.js +3 -0
- package/dist/components/resizable/index.js.map +1 -0
- package/dist/components/scroll-area/index.js +3 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scrollable-list/index.js +3 -0
- package/dist/components/scrollable-list/index.js.map +1 -0
- package/dist/components/search-field/index.js +4 -0
- package/dist/components/search-field/index.js.map +1 -0
- package/dist/components/segmented-control/segmented-control-contract.js +3 -0
- package/dist/components/segmented-control/segmented-control-contract.js.map +1 -0
- package/dist/components/select/select-contract.js +3 -0
- package/dist/components/select/select-contract.js.map +1 -0
- package/dist/components/selection/index.js +4 -0
- package/dist/components/selection/index.js.map +1 -0
- package/dist/components/separator/separator-contract.js +3 -0
- package/dist/components/separator/separator-contract.js.map +1 -0
- package/dist/components/sheet/index.js +3 -0
- package/dist/components/sheet/index.js.map +1 -0
- package/dist/components/sidebar/sidebar-contract.js +3 -0
- package/dist/components/sidebar/sidebar-contract.js.map +1 -0
- package/dist/components/sidebar-nav-tree/index.js +3 -0
- package/dist/components/sidebar-nav-tree/index.js.map +1 -0
- package/dist/components/skeleton/index.js +3 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/spinner/index.js +3 -0
- package/dist/components/spinner/index.js.map +1 -0
- package/dist/components/switch/switch-contract.js +4 -0
- package/dist/components/switch/switch-contract.js.map +1 -0
- package/dist/components/table/index.js +3 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/tabs/index.js +3 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text-ticker/index.js +3 -0
- package/dist/components/text-ticker/index.js.map +1 -0
- package/dist/components/textarea/index.js +3 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/toaster/index.js +3 -0
- package/dist/components/toaster/index.js.map +1 -0
- package/dist/components/toggle/toggle-contract.js +3 -0
- package/dist/components/toggle/toggle-contract.js.map +1 -0
- package/dist/components/toggle-group/toggle-group-contract.js +3 -0
- package/dist/components/toggle-group/toggle-group-contract.js.map +1 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/conformance/index.js +3 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/environment.js +4 -0
- package/dist/environment.js.map +1 -0
- package/dist/index.d.ts +215 -64
- package/dist/index.js +85 -5204
- package/dist/index.js.map +1 -1
- package/dist/visual-archetypes.js +3 -0
- package/dist/visual-archetypes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1445 @@
|
|
|
1
|
+
// src/a11y/accordion.ts
|
|
2
|
+
function expanded(at, value) {
|
|
3
|
+
return { target: { part: "header", at }, attribute: "aria-expanded", equals: value };
|
|
4
|
+
}
|
|
5
|
+
var accordionPattern = {
|
|
6
|
+
id: "accordion",
|
|
7
|
+
name: "Accordion",
|
|
8
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/accordion/",
|
|
9
|
+
options: { collapse: ["collapsible", "keep-one"], expand: ["single", "multiple"] },
|
|
10
|
+
parts: {
|
|
11
|
+
heading: {
|
|
12
|
+
description: "The heading, with an aria-level, that wraps each header button.",
|
|
13
|
+
multiple: true,
|
|
14
|
+
name: "required",
|
|
15
|
+
role: "heading"
|
|
16
|
+
},
|
|
17
|
+
header: {
|
|
18
|
+
description: "The header buttons, each titled by the section name.",
|
|
19
|
+
multiple: true,
|
|
20
|
+
name: "required",
|
|
21
|
+
role: "button"
|
|
22
|
+
},
|
|
23
|
+
panel: {
|
|
24
|
+
description: "The expanded panel, a region labelled by its header button.",
|
|
25
|
+
name: "required",
|
|
26
|
+
role: "region"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
tree: [
|
|
30
|
+
{ part: "heading", children: [{ part: "header", states: ["expanded"] }] },
|
|
31
|
+
{ part: "panel" }
|
|
32
|
+
],
|
|
33
|
+
structure: [
|
|
34
|
+
{
|
|
35
|
+
id: "header-expanded-state",
|
|
36
|
+
requirement: "required",
|
|
37
|
+
rule: "Every header button has aria-expanded: true when its panel is visible, false when it is hidden.",
|
|
38
|
+
target: { part: "header" },
|
|
39
|
+
attribute: "aria-expanded",
|
|
40
|
+
equals: ["true", "false"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "header-controls-panel",
|
|
44
|
+
requirement: "required",
|
|
45
|
+
rule: "Every header button has aria-controls referring to the element that holds its panel.",
|
|
46
|
+
target: { part: "header" },
|
|
47
|
+
attribute: "aria-controls"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "expanded-header-controls-panel",
|
|
51
|
+
requirement: "required",
|
|
52
|
+
rule: "The header button of the expanded panel has aria-controls referring to that panel.",
|
|
53
|
+
target: { part: "header", at: "first" },
|
|
54
|
+
attribute: "aria-controls",
|
|
55
|
+
references: "panel"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "panel-labelled-by-header",
|
|
59
|
+
requirement: "optional",
|
|
60
|
+
rule: "A panel with the region role has aria-labelledby referring to its header button.",
|
|
61
|
+
target: { part: "panel" },
|
|
62
|
+
attribute: "aria-labelledby",
|
|
63
|
+
references: "header"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
keyboard: [
|
|
67
|
+
{
|
|
68
|
+
id: "enter-expands",
|
|
69
|
+
key: "Enter",
|
|
70
|
+
keys: "{Enter}",
|
|
71
|
+
requirement: "required",
|
|
72
|
+
given: { focus: { part: "header", at: 1 }, attributes: [expanded(1, "false")] },
|
|
73
|
+
result: "On the header of a collapsed panel, expands the panel.",
|
|
74
|
+
then: { focus: { part: "header", at: 1 }, attributes: [expanded(1, "true")] }
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "space-expands",
|
|
78
|
+
key: "Space",
|
|
79
|
+
keys: "{ }",
|
|
80
|
+
requirement: "required",
|
|
81
|
+
given: { focus: { part: "header", at: 1 }, attributes: [expanded(1, "false")] },
|
|
82
|
+
result: "On the header of a collapsed panel, expands the panel.",
|
|
83
|
+
then: { focus: { part: "header", at: 1 }, attributes: [expanded(1, "true")] }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "enter-collapses-other",
|
|
87
|
+
key: "Enter",
|
|
88
|
+
keys: "{Enter}",
|
|
89
|
+
requirement: "required",
|
|
90
|
+
when: { expand: "single" },
|
|
91
|
+
given: { focus: { part: "header", at: 1 }, attributes: [expanded("first", "true")] },
|
|
92
|
+
result: "When only one panel can be expanded, expanding a panel collapses the one that was open.",
|
|
93
|
+
then: { attributes: [expanded(1, "true"), expanded("first", "false")] }
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "enter-keeps-other",
|
|
97
|
+
key: "Enter",
|
|
98
|
+
keys: "{Enter}",
|
|
99
|
+
requirement: "required",
|
|
100
|
+
when: { expand: "multiple" },
|
|
101
|
+
given: { focus: { part: "header", at: 1 }, attributes: [expanded("first", "true")] },
|
|
102
|
+
result: "When several panels can be expanded, expanding a panel leaves the open one expanded.",
|
|
103
|
+
then: { attributes: [expanded(1, "true"), expanded("first", "true")] }
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "enter-collapses",
|
|
107
|
+
key: "Enter",
|
|
108
|
+
keys: "{Enter}",
|
|
109
|
+
requirement: "required",
|
|
110
|
+
when: { collapse: "collapsible" },
|
|
111
|
+
given: { focus: { part: "header", at: "first" }, attributes: [expanded("first", "true")] },
|
|
112
|
+
result: "On the header of an expanded panel, collapses the panel.",
|
|
113
|
+
then: { focus: { part: "header", at: "first" }, attributes: [expanded("first", "false")] }
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "space-collapses",
|
|
117
|
+
key: "Space",
|
|
118
|
+
keys: "{ }",
|
|
119
|
+
requirement: "required",
|
|
120
|
+
when: { collapse: "collapsible" },
|
|
121
|
+
given: { focus: { part: "header", at: "first" }, attributes: [expanded("first", "true")] },
|
|
122
|
+
result: "On the header of an expanded panel, collapses the panel.",
|
|
123
|
+
then: { focus: { part: "header", at: "first" }, attributes: [expanded("first", "false")] }
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "enter-keeps-open",
|
|
127
|
+
key: "Enter",
|
|
128
|
+
keys: "{Enter}",
|
|
129
|
+
requirement: "required",
|
|
130
|
+
when: { collapse: "keep-one" },
|
|
131
|
+
given: { focus: { part: "header", at: "first" }, attributes: [expanded("first", "true")] },
|
|
132
|
+
result: "On the header of the one expanded panel, the panel stays expanded.",
|
|
133
|
+
then: {
|
|
134
|
+
focus: { part: "header", at: "first" },
|
|
135
|
+
attributes: [
|
|
136
|
+
expanded("first", "true"),
|
|
137
|
+
{ target: { part: "header", at: "first" }, attribute: "aria-disabled", equals: "true" }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: "tab-next-header",
|
|
143
|
+
key: "Tab",
|
|
144
|
+
keys: "{Tab}",
|
|
145
|
+
requirement: "required",
|
|
146
|
+
given: { focus: { part: "header", at: 1 }, attributes: [expanded(1, "false")] },
|
|
147
|
+
result: "Moves focus to the next focusable element: past a collapsed panel, the next header.",
|
|
148
|
+
then: { focus: { part: "header", at: 2 } }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "shift-tab-previous-header",
|
|
152
|
+
key: "Shift + Tab",
|
|
153
|
+
keys: "{Shift>}{Tab}{/Shift}",
|
|
154
|
+
requirement: "required",
|
|
155
|
+
given: { focus: { part: "header", at: 2 }, attributes: [expanded(1, "false")] },
|
|
156
|
+
result: "Moves focus to the previous focusable element: past a collapsed panel, the previous header.",
|
|
157
|
+
then: { focus: { part: "header", at: 1 } }
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
ios: {
|
|
161
|
+
parts: {
|
|
162
|
+
header: {
|
|
163
|
+
description: "A disclosure group header: a button named by its label. iOS does not report expanded state to XCUITest, so the checks follow the content it reveals.",
|
|
164
|
+
name: "required",
|
|
165
|
+
type: "button"
|
|
166
|
+
},
|
|
167
|
+
panel: {
|
|
168
|
+
description: "Text of a disclosure group's content.",
|
|
169
|
+
name: "required",
|
|
170
|
+
type: "staticText"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
structure: [
|
|
174
|
+
{ target: { part: "header", label: "Implementation details" }, enabled: true },
|
|
175
|
+
{ target: { part: "header", label: "Unavailable details" }, enabled: false },
|
|
176
|
+
{
|
|
177
|
+
target: { part: "panel", label: "Native SwiftUI renderer with shared product intent." },
|
|
178
|
+
exists: false
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
interactions: [
|
|
182
|
+
{
|
|
183
|
+
id: "activation-expands",
|
|
184
|
+
action: "tap",
|
|
185
|
+
on: { part: "header", label: "Implementation details" },
|
|
186
|
+
result: "Expands the section and shows its content.",
|
|
187
|
+
then: [
|
|
188
|
+
{
|
|
189
|
+
target: { part: "panel", label: "Native SwiftUI renderer with shared product intent." },
|
|
190
|
+
exists: true
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "activation-collapses",
|
|
196
|
+
action: "tap",
|
|
197
|
+
on: { part: "header", label: "Implementation details" },
|
|
198
|
+
result: "Collapses the section and hides its content.",
|
|
199
|
+
then: [
|
|
200
|
+
{
|
|
201
|
+
target: { part: "panel", label: "Native SwiftUI renderer with shared product intent." },
|
|
202
|
+
exists: false
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// src/a11y/dialog.ts
|
|
211
|
+
function modalDialogKeyboard(dialog) {
|
|
212
|
+
return [
|
|
213
|
+
{
|
|
214
|
+
id: "open-moves-focus-inside",
|
|
215
|
+
key: "Enter",
|
|
216
|
+
keys: "{Enter}",
|
|
217
|
+
requirement: "required",
|
|
218
|
+
given: { open: false, focus: { part: "trigger" } },
|
|
219
|
+
result: "Activating the trigger opens the dialog and moves focus to an element inside it.",
|
|
220
|
+
then: { open: true, focus: { inside: dialog } }
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "tab-wraps",
|
|
224
|
+
key: "Tab",
|
|
225
|
+
keys: "{Tab}",
|
|
226
|
+
requirement: "required",
|
|
227
|
+
given: { open: true, focus: { part: dialog, tabbable: "last" } },
|
|
228
|
+
result: "Tab on the last tabbable element moves focus to the first one: focus stays inside.",
|
|
229
|
+
then: { open: true, focus: { part: dialog, tabbable: "first" } }
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "shift-tab-wraps",
|
|
233
|
+
key: "Shift + Tab",
|
|
234
|
+
keys: "{Shift>}{Tab}{/Shift}",
|
|
235
|
+
requirement: "required",
|
|
236
|
+
given: { open: true, focus: { part: dialog, tabbable: "first" } },
|
|
237
|
+
result: "Shift + Tab on the first tabbable element moves focus to the last one.",
|
|
238
|
+
then: { open: true, focus: { part: dialog, tabbable: "last" } }
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "escape-closes",
|
|
242
|
+
key: "Escape",
|
|
243
|
+
keys: "{Escape}",
|
|
244
|
+
requirement: "required",
|
|
245
|
+
given: { open: true, focus: { inside: dialog } },
|
|
246
|
+
result: "Escape closes the dialog and returns focus to the element that opened it.",
|
|
247
|
+
then: { open: false, focus: { part: "trigger" } }
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
var dialogModalPattern = {
|
|
252
|
+
id: "dialog-modal",
|
|
253
|
+
name: "Dialog (Modal)",
|
|
254
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/",
|
|
255
|
+
parts: {
|
|
256
|
+
trigger: {
|
|
257
|
+
description: "The element that opens the dialog and gets focus back when it closes.",
|
|
258
|
+
name: "required",
|
|
259
|
+
role: "button"
|
|
260
|
+
},
|
|
261
|
+
dialog: {
|
|
262
|
+
description: "The dialog container; every element of the dialog is inside it.",
|
|
263
|
+
name: "required",
|
|
264
|
+
role: "dialog",
|
|
265
|
+
whileOpen: true
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
popup: "dialog",
|
|
269
|
+
opener: { part: "trigger", keys: "{Enter}" },
|
|
270
|
+
tree: [{ part: "dialog" }],
|
|
271
|
+
structure: [
|
|
272
|
+
{
|
|
273
|
+
id: "dialog-is-modal",
|
|
274
|
+
requirement: "required",
|
|
275
|
+
rule: "The dialog container has aria-modal set to true.",
|
|
276
|
+
target: { part: "dialog" },
|
|
277
|
+
attribute: "aria-modal",
|
|
278
|
+
equals: "true"
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
keyboard: modalDialogKeyboard("dialog"),
|
|
282
|
+
ios: {
|
|
283
|
+
parts: {
|
|
284
|
+
trigger: {
|
|
285
|
+
description: "The button that opens the sheet.",
|
|
286
|
+
name: "required",
|
|
287
|
+
type: "button"
|
|
288
|
+
},
|
|
289
|
+
title: {
|
|
290
|
+
description: "The sheet's title, which names it.",
|
|
291
|
+
name: "required",
|
|
292
|
+
scope: "app",
|
|
293
|
+
type: "staticText"
|
|
294
|
+
},
|
|
295
|
+
close: {
|
|
296
|
+
description: "The sheet's close action.",
|
|
297
|
+
name: "required",
|
|
298
|
+
scope: "app",
|
|
299
|
+
type: "button"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
structure: [{ target: { part: "trigger", label: "Open project sheet" }, exists: true }],
|
|
303
|
+
interactions: [
|
|
304
|
+
{
|
|
305
|
+
id: "activation-opens-sheet",
|
|
306
|
+
action: "tap",
|
|
307
|
+
on: { part: "trigger", label: "Open project sheet" },
|
|
308
|
+
result: "Opens the sheet, named by its title, with a way to close it.",
|
|
309
|
+
then: [
|
|
310
|
+
{ target: { part: "title", label: "Project details" }, exists: true },
|
|
311
|
+
{ target: { part: "close", label: "Done" }, exists: true }
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "close-dismisses-sheet",
|
|
316
|
+
action: "tap",
|
|
317
|
+
on: { part: "close", label: "Done" },
|
|
318
|
+
result: "Closes the sheet and returns to the view that opened it.",
|
|
319
|
+
then: [
|
|
320
|
+
{ target: { part: "title", label: "Project details" }, exists: false },
|
|
321
|
+
{ target: { part: "trigger", label: "Open project sheet" }, exists: true }
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/a11y/alert-dialog.ts
|
|
329
|
+
var alertDialogPattern = {
|
|
330
|
+
id: "alertdialog",
|
|
331
|
+
name: "Alert and Message Dialogs",
|
|
332
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/",
|
|
333
|
+
parts: {
|
|
334
|
+
trigger: {
|
|
335
|
+
description: "The element that opens the alert dialog and gets focus back when it closes.",
|
|
336
|
+
name: "required",
|
|
337
|
+
role: "button"
|
|
338
|
+
},
|
|
339
|
+
dialog: {
|
|
340
|
+
description: "The alert dialog container; every element of the dialog is inside it.",
|
|
341
|
+
name: "required",
|
|
342
|
+
role: "alertdialog",
|
|
343
|
+
whileOpen: true
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
popup: "dialog",
|
|
347
|
+
opener: { part: "trigger", keys: "{Enter}" },
|
|
348
|
+
tree: [{ part: "dialog" }],
|
|
349
|
+
structure: [
|
|
350
|
+
{
|
|
351
|
+
id: "dialog-is-modal",
|
|
352
|
+
requirement: "required",
|
|
353
|
+
rule: "The alert dialog container has aria-modal set to true.",
|
|
354
|
+
target: { part: "dialog" },
|
|
355
|
+
attribute: "aria-modal",
|
|
356
|
+
equals: "true"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "dialog-describes-message",
|
|
360
|
+
requirement: "required",
|
|
361
|
+
rule: "aria-describedby refers to the element that holds the alert message.",
|
|
362
|
+
target: { part: "dialog" },
|
|
363
|
+
attribute: "aria-describedby",
|
|
364
|
+
resolves: true
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
keyboard: modalDialogKeyboard("dialog"),
|
|
368
|
+
ios: {
|
|
369
|
+
parts: {
|
|
370
|
+
trigger: {
|
|
371
|
+
description: "The button that asks for confirmation.",
|
|
372
|
+
name: "required",
|
|
373
|
+
type: "button"
|
|
374
|
+
},
|
|
375
|
+
alert: {
|
|
376
|
+
description: "The system alert, named by its title.",
|
|
377
|
+
name: "required",
|
|
378
|
+
scope: "app",
|
|
379
|
+
type: "alert"
|
|
380
|
+
},
|
|
381
|
+
cancel: {
|
|
382
|
+
description: "The alert's cancel action.",
|
|
383
|
+
name: "required",
|
|
384
|
+
scope: "app",
|
|
385
|
+
type: "button"
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
structure: [{ target: { part: "trigger", at: "first" }, exists: true }],
|
|
389
|
+
interactions: [
|
|
390
|
+
{
|
|
391
|
+
id: "activation-opens-alert",
|
|
392
|
+
action: "tap",
|
|
393
|
+
on: { part: "trigger", at: "first" },
|
|
394
|
+
result: "Opens the alert dialog, named by its title.",
|
|
395
|
+
then: [{ target: { part: "alert", at: "first" }, exists: true }]
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
id: "cancel-closes-alert",
|
|
399
|
+
action: "tap",
|
|
400
|
+
on: { part: "cancel", label: "Cancel" },
|
|
401
|
+
result: "Closes the alert without performing the action.",
|
|
402
|
+
then: [{ target: { part: "alert" }, exists: false }]
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// src/a11y/checkbox.ts
|
|
409
|
+
function checked(value) {
|
|
410
|
+
return { target: { part: "checkbox", at: "first" }, attribute: "aria-checked", equals: value };
|
|
411
|
+
}
|
|
412
|
+
var checkboxPattern = {
|
|
413
|
+
id: "checkbox",
|
|
414
|
+
name: "Checkbox",
|
|
415
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/",
|
|
416
|
+
parts: {
|
|
417
|
+
checkbox: {
|
|
418
|
+
description: "The checkbox, labelled by its content, by aria-labelledby or by aria-label.",
|
|
419
|
+
name: "required",
|
|
420
|
+
role: "checkbox"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
tree: [{ part: "checkbox", states: ["checked"] }],
|
|
424
|
+
structure: [
|
|
425
|
+
{
|
|
426
|
+
id: "checkbox-checked-state",
|
|
427
|
+
requirement: "required",
|
|
428
|
+
rule: "The checkbox has aria-checked set to true when checked, false when not checked and mixed when partially checked.",
|
|
429
|
+
target: { part: "checkbox" },
|
|
430
|
+
attribute: "aria-checked",
|
|
431
|
+
equals: ["true", "false", "mixed"]
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
keyboard: [
|
|
435
|
+
{
|
|
436
|
+
id: "space-toggles",
|
|
437
|
+
key: "Space",
|
|
438
|
+
keys: "{ }",
|
|
439
|
+
requirement: "required",
|
|
440
|
+
given: { focus: { part: "checkbox", at: "first" }, attributes: [checked("true")] },
|
|
441
|
+
result: "Changes the state of the checkbox.",
|
|
442
|
+
then: { focus: { part: "checkbox", at: "first" }, attributes: [checked("false")] }
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
// src/a11y/combobox-select-only.ts
|
|
448
|
+
var EXPANDED = {
|
|
449
|
+
target: { part: "combobox" },
|
|
450
|
+
attribute: "aria-expanded",
|
|
451
|
+
equals: "true"
|
|
452
|
+
};
|
|
453
|
+
var COLLAPSED = { ...EXPANDED, equals: "false" };
|
|
454
|
+
function selected(at) {
|
|
455
|
+
return { target: { part: "option", at }, attribute: "aria-selected", equals: "true" };
|
|
456
|
+
}
|
|
457
|
+
var comboboxSelectOnlyPattern = {
|
|
458
|
+
id: "combobox-select-only",
|
|
459
|
+
name: "Select-Only Combobox",
|
|
460
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/",
|
|
461
|
+
parts: {
|
|
462
|
+
combobox: {
|
|
463
|
+
description: "The element that shows the value and opens the listbox, labelled by a label, aria-labelledby or aria-label.",
|
|
464
|
+
name: "required",
|
|
465
|
+
role: "combobox"
|
|
466
|
+
},
|
|
467
|
+
listbox: {
|
|
468
|
+
description: "The popup that lists the options.",
|
|
469
|
+
name: "none",
|
|
470
|
+
role: "listbox",
|
|
471
|
+
whileOpen: true
|
|
472
|
+
},
|
|
473
|
+
option: {
|
|
474
|
+
description: "The options of the listbox, each named by its text.",
|
|
475
|
+
multiple: true,
|
|
476
|
+
name: "required",
|
|
477
|
+
role: "option",
|
|
478
|
+
whileOpen: true,
|
|
479
|
+
within: "listbox"
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
popup: "listbox",
|
|
483
|
+
opener: { part: "combobox", keys: "{Enter}" },
|
|
484
|
+
tree: [
|
|
485
|
+
{ part: "combobox", states: ["expanded"] },
|
|
486
|
+
{ part: "listbox", children: [{ part: "option", states: ["selected"] }] }
|
|
487
|
+
],
|
|
488
|
+
structure: [
|
|
489
|
+
{
|
|
490
|
+
id: "combobox-expanded",
|
|
491
|
+
requirement: "required",
|
|
492
|
+
rule: "While the listbox is displayed, the combobox has aria-expanded set to true.",
|
|
493
|
+
...EXPANDED
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
id: "combobox-controls-listbox",
|
|
497
|
+
requirement: "required",
|
|
498
|
+
rule: "The combobox has aria-controls referring to the listbox.",
|
|
499
|
+
target: { part: "combobox" },
|
|
500
|
+
attribute: "aria-controls",
|
|
501
|
+
references: "listbox"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: "combobox-has-popup",
|
|
505
|
+
requirement: "optional",
|
|
506
|
+
rule: "The combobox may set aria-haspopup to listbox, its implicit value.",
|
|
507
|
+
target: { part: "combobox" },
|
|
508
|
+
attribute: "aria-haspopup",
|
|
509
|
+
equals: "listbox"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
id: "combobox-active-descendant",
|
|
513
|
+
requirement: "required",
|
|
514
|
+
rule: "While an option has visual focus, DOM focus stays on the combobox and its aria-activedescendant refers to that option.",
|
|
515
|
+
target: { part: "combobox" },
|
|
516
|
+
attribute: "aria-activedescendant",
|
|
517
|
+
references: "option"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
id: "option-selected",
|
|
521
|
+
requirement: "required",
|
|
522
|
+
rule: "The selected option has aria-selected set to true.",
|
|
523
|
+
target: { part: "option", at: "selected" },
|
|
524
|
+
attribute: "aria-selected",
|
|
525
|
+
equals: "true"
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
keyboard: [
|
|
529
|
+
{
|
|
530
|
+
id: "enter-opens",
|
|
531
|
+
key: "Enter",
|
|
532
|
+
keys: "{Enter}",
|
|
533
|
+
requirement: "required",
|
|
534
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
535
|
+
result: "Opens the listbox without changing the selection; visual focus is on the selected option.",
|
|
536
|
+
then: {
|
|
537
|
+
open: true,
|
|
538
|
+
focus: { part: "option", at: "selected" },
|
|
539
|
+
attributes: [EXPANDED, selected("first")]
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: "space-opens",
|
|
544
|
+
key: "Space",
|
|
545
|
+
keys: "{ }",
|
|
546
|
+
requirement: "required",
|
|
547
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
548
|
+
result: "Opens the listbox without changing the selection; visual focus is on the selected option.",
|
|
549
|
+
then: {
|
|
550
|
+
open: true,
|
|
551
|
+
focus: { part: "option", at: "selected" },
|
|
552
|
+
attributes: [EXPANDED, selected("first")]
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
id: "down-arrow-opens",
|
|
557
|
+
key: "Down Arrow",
|
|
558
|
+
keys: "{ArrowDown}",
|
|
559
|
+
requirement: "required",
|
|
560
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
561
|
+
result: "Opens the listbox without changing the selection; visual focus is on the selected option.",
|
|
562
|
+
then: {
|
|
563
|
+
open: true,
|
|
564
|
+
focus: { part: "option", at: "selected" },
|
|
565
|
+
attributes: [EXPANDED, selected("first")]
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
id: "alt-down-arrow-opens",
|
|
570
|
+
key: "Alt + Down Arrow",
|
|
571
|
+
keys: "{Alt>}{ArrowDown}{/Alt}",
|
|
572
|
+
requirement: "optional",
|
|
573
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
574
|
+
result: "Opens the listbox without changing the selection.",
|
|
575
|
+
then: { open: true, attributes: [EXPANDED, selected("first")] }
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
id: "up-arrow-opens",
|
|
579
|
+
key: "Up Arrow",
|
|
580
|
+
keys: "{ArrowUp}",
|
|
581
|
+
requirement: "optional",
|
|
582
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
583
|
+
result: "Opens the listbox and moves visual focus to the first option.",
|
|
584
|
+
then: { open: true, focus: { part: "option", at: "first" } }
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "home-opens-at-first",
|
|
588
|
+
key: "Home",
|
|
589
|
+
keys: "{Home}",
|
|
590
|
+
requirement: "optional",
|
|
591
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
592
|
+
result: "Opens the listbox and moves visual focus to the first option.",
|
|
593
|
+
then: { open: true, focus: { part: "option", at: "first" } }
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
id: "end-opens-at-last",
|
|
597
|
+
key: "End",
|
|
598
|
+
keys: "{End}",
|
|
599
|
+
requirement: "optional",
|
|
600
|
+
given: { open: false, focus: { part: "combobox" } },
|
|
601
|
+
result: "Opens the listbox and moves visual focus to the last option.",
|
|
602
|
+
then: { open: true, focus: { part: "option", at: "last" } }
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
id: "down-arrow-next",
|
|
606
|
+
key: "Down Arrow",
|
|
607
|
+
keys: "{ArrowDown}",
|
|
608
|
+
requirement: "required",
|
|
609
|
+
given: { open: true, focus: { part: "option", at: "first" } },
|
|
610
|
+
result: "Moves visual focus to the next option.",
|
|
611
|
+
then: { open: true, focus: { part: "option", at: 1 } }
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
id: "down-arrow-stops",
|
|
615
|
+
key: "Down Arrow",
|
|
616
|
+
keys: "{ArrowDown}",
|
|
617
|
+
requirement: "required",
|
|
618
|
+
given: { open: true, focus: { part: "option", at: "last" } },
|
|
619
|
+
result: "On the last option, visual focus does not move.",
|
|
620
|
+
then: { open: true, focus: { part: "option", at: "last" } }
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
id: "up-arrow-previous",
|
|
624
|
+
key: "Up Arrow",
|
|
625
|
+
keys: "{ArrowUp}",
|
|
626
|
+
requirement: "required",
|
|
627
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
628
|
+
result: "Moves visual focus to the previous option.",
|
|
629
|
+
then: { open: true, focus: { part: "option", at: "first" } }
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
id: "up-arrow-stops",
|
|
633
|
+
key: "Up Arrow",
|
|
634
|
+
keys: "{ArrowUp}",
|
|
635
|
+
requirement: "required",
|
|
636
|
+
given: { open: true, focus: { part: "option", at: "first" } },
|
|
637
|
+
result: "On the first option, visual focus does not move.",
|
|
638
|
+
then: { open: true, focus: { part: "option", at: "first" } }
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
id: "home-first",
|
|
642
|
+
key: "Home",
|
|
643
|
+
keys: "{Home}",
|
|
644
|
+
requirement: "optional",
|
|
645
|
+
given: { open: true, focus: { part: "option", at: "last" } },
|
|
646
|
+
result: "Moves visual focus to the first option.",
|
|
647
|
+
then: { open: true, focus: { part: "option", at: "first" } }
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: "end-last",
|
|
651
|
+
key: "End",
|
|
652
|
+
keys: "{End}",
|
|
653
|
+
requirement: "optional",
|
|
654
|
+
given: { open: true, focus: { part: "option", at: "first" } },
|
|
655
|
+
result: "Moves visual focus to the last option.",
|
|
656
|
+
then: { open: true, focus: { part: "option", at: "last" } }
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
id: "enter-selects",
|
|
660
|
+
key: "Enter",
|
|
661
|
+
keys: "{Enter}",
|
|
662
|
+
requirement: "required",
|
|
663
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
664
|
+
result: "Selects the focused option, closes the listbox and returns focus to the combobox.",
|
|
665
|
+
then: { open: false, focus: { part: "combobox" }, attributes: [COLLAPSED, selected(1)] }
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
id: "space-selects",
|
|
669
|
+
key: "Space",
|
|
670
|
+
keys: "{ }",
|
|
671
|
+
requirement: "required",
|
|
672
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
673
|
+
result: "Selects the focused option, closes the listbox and returns focus to the combobox.",
|
|
674
|
+
then: { open: false, focus: { part: "combobox" }, attributes: [COLLAPSED, selected(1)] }
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
id: "alt-up-arrow-selects",
|
|
678
|
+
key: "Alt + Up Arrow",
|
|
679
|
+
keys: "{Alt>}{ArrowUp}{/Alt}",
|
|
680
|
+
requirement: "optional",
|
|
681
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
682
|
+
result: "Selects the focused option, closes the listbox and returns focus to the combobox.",
|
|
683
|
+
then: { open: false, focus: { part: "combobox" }, attributes: [COLLAPSED, selected(1)] }
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
id: "tab-selects",
|
|
687
|
+
key: "Tab",
|
|
688
|
+
keys: "{Tab}",
|
|
689
|
+
requirement: "required",
|
|
690
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
691
|
+
result: "Selects the focused option and closes the listbox.",
|
|
692
|
+
then: { open: false, attributes: [COLLAPSED, selected(1)] }
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
id: "escape-closes",
|
|
696
|
+
key: "Escape",
|
|
697
|
+
keys: "{Escape}",
|
|
698
|
+
requirement: "required",
|
|
699
|
+
given: { open: true, focus: { part: "option", at: 1 } },
|
|
700
|
+
result: "Closes the listbox without changing the selection and returns focus to the combobox.",
|
|
701
|
+
then: {
|
|
702
|
+
open: false,
|
|
703
|
+
focus: { part: "combobox" },
|
|
704
|
+
attributes: [COLLAPSED, selected("first")]
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
ios: {
|
|
709
|
+
parts: {
|
|
710
|
+
trigger: {
|
|
711
|
+
description: "A menu-style picker: a button named by its label, with the current value in the label.",
|
|
712
|
+
name: "required",
|
|
713
|
+
type: "button"
|
|
714
|
+
},
|
|
715
|
+
option: {
|
|
716
|
+
description: "An option in the list the picker opens; the current one is selected.",
|
|
717
|
+
name: "required",
|
|
718
|
+
scope: "popup",
|
|
719
|
+
type: "button"
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
structure: [
|
|
723
|
+
{ target: { part: "trigger", at: "first" }, labelIncludes: "Draft" },
|
|
724
|
+
{ target: { part: "trigger", at: "last" }, enabled: false }
|
|
725
|
+
],
|
|
726
|
+
interactions: [
|
|
727
|
+
{
|
|
728
|
+
id: "activation-opens-options",
|
|
729
|
+
action: "tap",
|
|
730
|
+
on: { part: "trigger", at: "first" },
|
|
731
|
+
result: "Opens the list of options with the current one selected.",
|
|
732
|
+
then: [
|
|
733
|
+
{ target: { part: "option" }, exists: true },
|
|
734
|
+
{ target: { part: "option", label: "Draft" }, selected: true },
|
|
735
|
+
{ target: { part: "option", label: "Active" }, selected: false }
|
|
736
|
+
]
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
id: "choosing-an-option-closes-and-updates",
|
|
740
|
+
action: "tap",
|
|
741
|
+
on: { part: "option", label: "Active" },
|
|
742
|
+
result: "Selects the option, closes the list and shows the new value.",
|
|
743
|
+
then: [
|
|
744
|
+
{ target: { part: "option" }, exists: false },
|
|
745
|
+
{ target: { part: "trigger", at: "first" }, labelIncludes: "Active" }
|
|
746
|
+
]
|
|
747
|
+
}
|
|
748
|
+
]
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// src/a11y/menu.ts
|
|
753
|
+
var TRIGGER_EXPANDED = {
|
|
754
|
+
target: { part: "trigger" },
|
|
755
|
+
attribute: "aria-expanded",
|
|
756
|
+
equals: "true"
|
|
757
|
+
};
|
|
758
|
+
var TRIGGER_COLLAPSED = { ...TRIGGER_EXPANDED, equals: "false" };
|
|
759
|
+
var menuButtonPattern = {
|
|
760
|
+
id: "menu-button",
|
|
761
|
+
name: "Menu Button",
|
|
762
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/",
|
|
763
|
+
options: { wrap: ["wrap", "stop"] },
|
|
764
|
+
parts: {
|
|
765
|
+
trigger: {
|
|
766
|
+
description: "The button that opens the menu.",
|
|
767
|
+
name: "required",
|
|
768
|
+
role: "button"
|
|
769
|
+
},
|
|
770
|
+
menu: {
|
|
771
|
+
description: "The menu, labelled by the button that controls it or by aria-label.",
|
|
772
|
+
name: "required",
|
|
773
|
+
role: "menu",
|
|
774
|
+
whileOpen: true
|
|
775
|
+
},
|
|
776
|
+
item: {
|
|
777
|
+
description: "The items of the menu.",
|
|
778
|
+
multiple: true,
|
|
779
|
+
name: "required",
|
|
780
|
+
role: "menuitem",
|
|
781
|
+
whileOpen: true,
|
|
782
|
+
within: "menu"
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
popup: "menu",
|
|
786
|
+
opener: { part: "trigger", keys: "{Enter}" },
|
|
787
|
+
tree: [{ part: "menu", children: [{ part: "item" }] }],
|
|
788
|
+
structure: [
|
|
789
|
+
{
|
|
790
|
+
id: "trigger-has-popup",
|
|
791
|
+
requirement: "required",
|
|
792
|
+
rule: "The button has aria-haspopup set to menu or true.",
|
|
793
|
+
target: { part: "trigger" },
|
|
794
|
+
attribute: "aria-haspopup",
|
|
795
|
+
equals: ["menu", "true"]
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
id: "trigger-expanded",
|
|
799
|
+
requirement: "required",
|
|
800
|
+
rule: "While the menu is displayed, the button has aria-expanded set to true.",
|
|
801
|
+
...TRIGGER_EXPANDED
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
id: "trigger-controls-menu",
|
|
805
|
+
requirement: "optional",
|
|
806
|
+
rule: "The button may have aria-controls referring to the menu.",
|
|
807
|
+
target: { part: "trigger" },
|
|
808
|
+
attribute: "aria-controls",
|
|
809
|
+
references: "menu"
|
|
810
|
+
}
|
|
811
|
+
],
|
|
812
|
+
keyboard: [
|
|
813
|
+
{
|
|
814
|
+
id: "enter-opens",
|
|
815
|
+
key: "Enter",
|
|
816
|
+
keys: "{Enter}",
|
|
817
|
+
requirement: "required",
|
|
818
|
+
given: { open: false, focus: { part: "trigger" } },
|
|
819
|
+
result: "Opens the menu and moves focus to the first item.",
|
|
820
|
+
then: { open: true, focus: { part: "item", at: "first" }, attributes: [TRIGGER_EXPANDED] }
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
id: "space-opens",
|
|
824
|
+
key: "Space",
|
|
825
|
+
keys: "{ }",
|
|
826
|
+
requirement: "required",
|
|
827
|
+
given: { open: false, focus: { part: "trigger" } },
|
|
828
|
+
result: "Opens the menu and moves focus to the first item.",
|
|
829
|
+
then: { open: true, focus: { part: "item", at: "first" }, attributes: [TRIGGER_EXPANDED] }
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
id: "down-arrow-opens",
|
|
833
|
+
key: "Down Arrow",
|
|
834
|
+
keys: "{ArrowDown}",
|
|
835
|
+
requirement: "optional",
|
|
836
|
+
given: { open: false, focus: { part: "trigger" } },
|
|
837
|
+
result: "Opens the menu and moves focus to the first item.",
|
|
838
|
+
then: { open: true, focus: { part: "item", at: "first" } }
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
id: "up-arrow-opens-at-last",
|
|
842
|
+
key: "Up Arrow",
|
|
843
|
+
keys: "{ArrowUp}",
|
|
844
|
+
requirement: "optional",
|
|
845
|
+
given: { open: false, focus: { part: "trigger" } },
|
|
846
|
+
result: "Opens the menu and moves focus to the last item.",
|
|
847
|
+
then: { open: true, focus: { part: "item", at: "last" } }
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
id: "down-arrow-next",
|
|
851
|
+
key: "Down Arrow",
|
|
852
|
+
keys: "{ArrowDown}",
|
|
853
|
+
requirement: "required",
|
|
854
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
855
|
+
result: "Moves focus to the next item.",
|
|
856
|
+
then: { open: true, focus: { part: "item", at: 1 } }
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
id: "down-arrow-wraps",
|
|
860
|
+
key: "Down Arrow",
|
|
861
|
+
keys: "{ArrowDown}",
|
|
862
|
+
requirement: "optional",
|
|
863
|
+
when: { wrap: "wrap" },
|
|
864
|
+
given: { open: true, focus: { part: "item", at: "last" } },
|
|
865
|
+
result: "On the last item, moves focus to the first item.",
|
|
866
|
+
then: { open: true, focus: { part: "item", at: "first" } }
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
id: "down-arrow-stops",
|
|
870
|
+
key: "Down Arrow",
|
|
871
|
+
keys: "{ArrowDown}",
|
|
872
|
+
requirement: "optional",
|
|
873
|
+
when: { wrap: "stop" },
|
|
874
|
+
given: { open: true, focus: { part: "item", at: "last" } },
|
|
875
|
+
result: "On the last item, focus stays on the last item.",
|
|
876
|
+
then: { open: true, focus: { part: "item", at: "last" } }
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
id: "up-arrow-previous",
|
|
880
|
+
key: "Up Arrow",
|
|
881
|
+
keys: "{ArrowUp}",
|
|
882
|
+
requirement: "required",
|
|
883
|
+
given: { open: true, focus: { part: "item", at: 1 } },
|
|
884
|
+
result: "Moves focus to the previous item.",
|
|
885
|
+
then: { open: true, focus: { part: "item", at: "first" } }
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
id: "up-arrow-wraps",
|
|
889
|
+
key: "Up Arrow",
|
|
890
|
+
keys: "{ArrowUp}",
|
|
891
|
+
requirement: "optional",
|
|
892
|
+
when: { wrap: "wrap" },
|
|
893
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
894
|
+
result: "On the first item, moves focus to the last item.",
|
|
895
|
+
then: { open: true, focus: { part: "item", at: "last" } }
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
id: "up-arrow-stops",
|
|
899
|
+
key: "Up Arrow",
|
|
900
|
+
keys: "{ArrowUp}",
|
|
901
|
+
requirement: "optional",
|
|
902
|
+
when: { wrap: "stop" },
|
|
903
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
904
|
+
result: "On the first item, focus stays on the first item.",
|
|
905
|
+
then: { open: true, focus: { part: "item", at: "first" } }
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
id: "home-first",
|
|
909
|
+
key: "Home",
|
|
910
|
+
keys: "{Home}",
|
|
911
|
+
requirement: "optional",
|
|
912
|
+
given: { open: true, focus: { part: "item", at: "last" } },
|
|
913
|
+
result: "Moves focus to the first item.",
|
|
914
|
+
then: { open: true, focus: { part: "item", at: "first" } }
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: "end-last",
|
|
918
|
+
key: "End",
|
|
919
|
+
keys: "{End}",
|
|
920
|
+
requirement: "optional",
|
|
921
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
922
|
+
result: "Moves focus to the last item.",
|
|
923
|
+
then: { open: true, focus: { part: "item", at: "last" } }
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
id: "enter-activates",
|
|
927
|
+
key: "Enter",
|
|
928
|
+
keys: "{Enter}",
|
|
929
|
+
requirement: "required",
|
|
930
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
931
|
+
result: "Activates the item and closes the menu.",
|
|
932
|
+
then: { open: false }
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
id: "escape-closes",
|
|
936
|
+
key: "Escape",
|
|
937
|
+
keys: "{Escape}",
|
|
938
|
+
requirement: "required",
|
|
939
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
940
|
+
result: "Closes the menu and returns focus to the button that opened it.",
|
|
941
|
+
then: { open: false, focus: { part: "trigger" }, attributes: [TRIGGER_COLLAPSED] }
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
id: "tab-closes",
|
|
945
|
+
key: "Tab",
|
|
946
|
+
keys: "{Tab}",
|
|
947
|
+
requirement: "required",
|
|
948
|
+
given: { open: true, focus: { part: "item", at: "first" } },
|
|
949
|
+
result: "Moves focus out of the menu and closes it.",
|
|
950
|
+
then: { open: false }
|
|
951
|
+
}
|
|
952
|
+
],
|
|
953
|
+
ios: {
|
|
954
|
+
parts: {
|
|
955
|
+
trigger: {
|
|
956
|
+
description: "The menu button, named by its label.",
|
|
957
|
+
name: "required",
|
|
958
|
+
type: "button"
|
|
959
|
+
},
|
|
960
|
+
item: {
|
|
961
|
+
description: "A menu item: a button named by its label; a checked choice is selected and an unavailable one disabled.",
|
|
962
|
+
name: "required",
|
|
963
|
+
scope: "popup",
|
|
964
|
+
type: "button"
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
structure: [{ target: { part: "trigger", at: "first" }, exists: true }],
|
|
968
|
+
interactions: [
|
|
969
|
+
{
|
|
970
|
+
id: "activation-opens-menu",
|
|
971
|
+
action: "tap",
|
|
972
|
+
on: { part: "trigger", at: "first" },
|
|
973
|
+
result: "Opens the menu.",
|
|
974
|
+
then: [
|
|
975
|
+
{ target: { part: "item" }, exists: true },
|
|
976
|
+
{ target: { part: "item", label: "Show details" }, selected: true },
|
|
977
|
+
{ target: { part: "item", label: "Unavailable action" }, enabled: false }
|
|
978
|
+
]
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
id: "activating-an-item-closes-menu",
|
|
982
|
+
action: "tap",
|
|
983
|
+
on: { part: "item", label: "Duplicate" },
|
|
984
|
+
result: "Performs the action and closes the menu.",
|
|
985
|
+
then: [{ target: { part: "item" }, exists: false }]
|
|
986
|
+
}
|
|
987
|
+
]
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
// src/a11y/radio.ts
|
|
992
|
+
function checked2(at) {
|
|
993
|
+
return { target: { part: "radio", at }, attribute: "aria-checked", equals: "true" };
|
|
994
|
+
}
|
|
995
|
+
function arrow(id, key, keys, from, to, result) {
|
|
996
|
+
return {
|
|
997
|
+
id,
|
|
998
|
+
key,
|
|
999
|
+
keys,
|
|
1000
|
+
requirement: "required",
|
|
1001
|
+
given: { focus: { part: "radio", at: from } },
|
|
1002
|
+
result,
|
|
1003
|
+
then: {
|
|
1004
|
+
focus: { part: "radio", at: to },
|
|
1005
|
+
attributes: [checked2(to), { ...checked2(from), equals: "false" }]
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
var radioPattern = {
|
|
1010
|
+
id: "radio",
|
|
1011
|
+
name: "Radio Group",
|
|
1012
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/radio/",
|
|
1013
|
+
parts: {
|
|
1014
|
+
radiogroup: {
|
|
1015
|
+
description: "The container of the radios, labelled by aria-labelledby or aria-label.",
|
|
1016
|
+
name: "required",
|
|
1017
|
+
role: "radiogroup"
|
|
1018
|
+
},
|
|
1019
|
+
radio: {
|
|
1020
|
+
description: "The radios, each labelled by its content, by aria-labelledby or by aria-label.",
|
|
1021
|
+
multiple: true,
|
|
1022
|
+
name: "required",
|
|
1023
|
+
role: "radio",
|
|
1024
|
+
within: "radiogroup"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
tree: [{ part: "radiogroup", children: [{ part: "radio", states: ["checked"] }] }],
|
|
1028
|
+
structure: [
|
|
1029
|
+
{
|
|
1030
|
+
id: "radio-checked-state",
|
|
1031
|
+
requirement: "required",
|
|
1032
|
+
rule: "Every radio has aria-checked: true on the checked radio, false on the others.",
|
|
1033
|
+
target: { part: "radio" },
|
|
1034
|
+
attribute: "aria-checked",
|
|
1035
|
+
equals: ["true", "false"]
|
|
1036
|
+
}
|
|
1037
|
+
],
|
|
1038
|
+
keyboard: [
|
|
1039
|
+
{
|
|
1040
|
+
id: "tab-enters-at-checked",
|
|
1041
|
+
key: "Tab",
|
|
1042
|
+
keys: "{Tab}",
|
|
1043
|
+
requirement: "required",
|
|
1044
|
+
given: { focus: "page-start", attributes: [checked2(1)] },
|
|
1045
|
+
result: "When focus moves into the group, it lands on the checked radio.",
|
|
1046
|
+
then: { focus: { part: "radio", at: "checked" } }
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
id: "space-checks",
|
|
1050
|
+
key: "Space",
|
|
1051
|
+
keys: "{ }",
|
|
1052
|
+
requirement: "required",
|
|
1053
|
+
given: {
|
|
1054
|
+
focus: { part: "radio", at: "first" },
|
|
1055
|
+
attributes: [{ ...checked2("first"), equals: "false" }]
|
|
1056
|
+
},
|
|
1057
|
+
result: "Checks the focused radio if it is not already checked.",
|
|
1058
|
+
then: { focus: { part: "radio", at: "first" }, attributes: [checked2("first")] }
|
|
1059
|
+
},
|
|
1060
|
+
arrow(
|
|
1061
|
+
"down-arrow-next",
|
|
1062
|
+
"Down Arrow",
|
|
1063
|
+
"{ArrowDown}",
|
|
1064
|
+
1,
|
|
1065
|
+
2,
|
|
1066
|
+
"Moves focus to the next radio, unchecks the previous one and checks the new one."
|
|
1067
|
+
),
|
|
1068
|
+
arrow(
|
|
1069
|
+
"right-arrow-next",
|
|
1070
|
+
"Right Arrow",
|
|
1071
|
+
"{ArrowRight}",
|
|
1072
|
+
1,
|
|
1073
|
+
2,
|
|
1074
|
+
"Moves focus to the next radio, unchecks the previous one and checks the new one."
|
|
1075
|
+
),
|
|
1076
|
+
arrow(
|
|
1077
|
+
"down-arrow-wraps",
|
|
1078
|
+
"Down Arrow",
|
|
1079
|
+
"{ArrowDown}",
|
|
1080
|
+
"last",
|
|
1081
|
+
"first",
|
|
1082
|
+
"On the last radio, moves focus to the first radio and checks it."
|
|
1083
|
+
),
|
|
1084
|
+
arrow(
|
|
1085
|
+
"up-arrow-previous",
|
|
1086
|
+
"Up Arrow",
|
|
1087
|
+
"{ArrowUp}",
|
|
1088
|
+
1,
|
|
1089
|
+
"first",
|
|
1090
|
+
"Moves focus to the previous radio, unchecks the previous one and checks the new one."
|
|
1091
|
+
),
|
|
1092
|
+
arrow(
|
|
1093
|
+
"left-arrow-previous",
|
|
1094
|
+
"Left Arrow",
|
|
1095
|
+
"{ArrowLeft}",
|
|
1096
|
+
1,
|
|
1097
|
+
"first",
|
|
1098
|
+
"Moves focus to the previous radio, unchecks the previous one and checks the new one."
|
|
1099
|
+
),
|
|
1100
|
+
arrow(
|
|
1101
|
+
"up-arrow-wraps",
|
|
1102
|
+
"Up Arrow",
|
|
1103
|
+
"{ArrowUp}",
|
|
1104
|
+
"first",
|
|
1105
|
+
"last",
|
|
1106
|
+
"On the first radio, moves focus to the last radio and checks it."
|
|
1107
|
+
)
|
|
1108
|
+
],
|
|
1109
|
+
ios: {
|
|
1110
|
+
parts: {
|
|
1111
|
+
group: {
|
|
1112
|
+
description: "The group's label, shown as the heading of its options.",
|
|
1113
|
+
name: "required",
|
|
1114
|
+
type: "staticText"
|
|
1115
|
+
},
|
|
1116
|
+
option: {
|
|
1117
|
+
description: "An option: a button named by its label; the chosen one is selected and an unavailable one disabled.",
|
|
1118
|
+
name: "required",
|
|
1119
|
+
type: "button"
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
structure: [
|
|
1123
|
+
{ target: { part: "group", label: "Default project view" }, exists: true },
|
|
1124
|
+
{ target: { part: "option", label: "Grid" }, selected: true },
|
|
1125
|
+
{ target: { part: "option", label: "List" }, selected: false },
|
|
1126
|
+
{ target: { part: "option", label: "Timeline" }, enabled: false }
|
|
1127
|
+
],
|
|
1128
|
+
interactions: [
|
|
1129
|
+
{
|
|
1130
|
+
id: "activation-selects-option",
|
|
1131
|
+
action: "tap",
|
|
1132
|
+
on: { part: "option", label: "List" },
|
|
1133
|
+
result: "Selects the option and clears the previous selection.",
|
|
1134
|
+
then: [
|
|
1135
|
+
{ target: { part: "option", label: "List" }, selected: true },
|
|
1136
|
+
{ target: { part: "option", label: "Grid" }, selected: false }
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
// src/a11y/switch.ts
|
|
1144
|
+
function checked3(value) {
|
|
1145
|
+
return { target: { part: "switch", at: "first" }, attribute: "aria-checked", equals: value };
|
|
1146
|
+
}
|
|
1147
|
+
var switchPattern = {
|
|
1148
|
+
id: "switch",
|
|
1149
|
+
name: "Switch",
|
|
1150
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/switch/",
|
|
1151
|
+
parts: {
|
|
1152
|
+
switch: {
|
|
1153
|
+
description: "The switch, labelled by its content, by aria-labelledby or by aria-label.",
|
|
1154
|
+
name: "required",
|
|
1155
|
+
role: "switch"
|
|
1156
|
+
}
|
|
1157
|
+
},
|
|
1158
|
+
tree: [{ part: "switch", states: ["checked"] }],
|
|
1159
|
+
structure: [
|
|
1160
|
+
{
|
|
1161
|
+
id: "switch-checked-state",
|
|
1162
|
+
requirement: "required",
|
|
1163
|
+
rule: "The switch has aria-checked set to true when on and to false when off.",
|
|
1164
|
+
target: { part: "switch" },
|
|
1165
|
+
attribute: "aria-checked",
|
|
1166
|
+
equals: ["true", "false"]
|
|
1167
|
+
}
|
|
1168
|
+
],
|
|
1169
|
+
keyboard: [
|
|
1170
|
+
{
|
|
1171
|
+
id: "space-toggles",
|
|
1172
|
+
key: "Space",
|
|
1173
|
+
keys: "{ }",
|
|
1174
|
+
requirement: "required",
|
|
1175
|
+
given: { focus: { part: "switch", at: "first" }, attributes: [checked3("true")] },
|
|
1176
|
+
result: "Changes the state of the switch.",
|
|
1177
|
+
then: { focus: { part: "switch", at: "first" }, attributes: [checked3("false")] }
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
id: "enter-toggles",
|
|
1181
|
+
key: "Enter",
|
|
1182
|
+
keys: "{Enter}",
|
|
1183
|
+
requirement: "optional",
|
|
1184
|
+
given: { focus: { part: "switch", at: "first" }, attributes: [checked3("true")] },
|
|
1185
|
+
result: "Changes the state of the switch.",
|
|
1186
|
+
then: { focus: { part: "switch", at: "first" }, attributes: [checked3("false")] }
|
|
1187
|
+
}
|
|
1188
|
+
],
|
|
1189
|
+
ios: {
|
|
1190
|
+
parts: {
|
|
1191
|
+
switch: {
|
|
1192
|
+
description: "A switch, named by its title (and description), with a value of 1 or 0.",
|
|
1193
|
+
name: "required",
|
|
1194
|
+
type: "switch"
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
structure: [
|
|
1198
|
+
{ target: { part: "switch", at: "first" }, value: "1" },
|
|
1199
|
+
{ target: { part: "switch", at: "last" }, value: "0" }
|
|
1200
|
+
],
|
|
1201
|
+
interactions: [
|
|
1202
|
+
{
|
|
1203
|
+
id: "activation-turns-off",
|
|
1204
|
+
action: "tap",
|
|
1205
|
+
on: { part: "switch", at: "first" },
|
|
1206
|
+
result: "Changes the state of the switch.",
|
|
1207
|
+
then: [{ target: { part: "switch", at: "first" }, value: "0" }]
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
id: "activation-turns-on",
|
|
1211
|
+
action: "tap",
|
|
1212
|
+
on: { part: "switch", at: "first" },
|
|
1213
|
+
result: "Changes the state of the switch back.",
|
|
1214
|
+
then: [{ target: { part: "switch", at: "first" }, value: "1" }]
|
|
1215
|
+
}
|
|
1216
|
+
]
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
// src/a11y/tabs.ts
|
|
1221
|
+
function selected2(at) {
|
|
1222
|
+
return { target: { part: "tab", at }, attribute: "aria-selected", equals: "true" };
|
|
1223
|
+
}
|
|
1224
|
+
var tabsPattern = {
|
|
1225
|
+
id: "tabs",
|
|
1226
|
+
name: "Tabs",
|
|
1227
|
+
source: "https://www.w3.org/WAI/ARIA/apg/patterns/tabs/",
|
|
1228
|
+
options: { activation: ["automatic", "manual"] },
|
|
1229
|
+
parts: {
|
|
1230
|
+
tablist: {
|
|
1231
|
+
description: "The container of the tabs, labelled by aria-labelledby or aria-label.",
|
|
1232
|
+
name: "required",
|
|
1233
|
+
role: "tablist"
|
|
1234
|
+
},
|
|
1235
|
+
tab: {
|
|
1236
|
+
description: "The tabs, each the label of one panel.",
|
|
1237
|
+
multiple: true,
|
|
1238
|
+
name: "required",
|
|
1239
|
+
role: "tab",
|
|
1240
|
+
within: "tablist"
|
|
1241
|
+
},
|
|
1242
|
+
panel: {
|
|
1243
|
+
description: "The panel of the selected tab, labelled by that tab.",
|
|
1244
|
+
name: "required",
|
|
1245
|
+
role: "tabpanel"
|
|
1246
|
+
}
|
|
1247
|
+
},
|
|
1248
|
+
tree: [{ part: "tablist", children: [{ part: "tab", states: ["selected"] }] }, { part: "panel" }],
|
|
1249
|
+
structure: [
|
|
1250
|
+
{
|
|
1251
|
+
id: "tab-selection-state",
|
|
1252
|
+
requirement: "required",
|
|
1253
|
+
rule: "Every tab has aria-selected: true on the selected tab, false on the others.",
|
|
1254
|
+
target: { part: "tab" },
|
|
1255
|
+
attribute: "aria-selected",
|
|
1256
|
+
equals: ["true", "false"]
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
id: "tab-controls-panel",
|
|
1260
|
+
requirement: "required",
|
|
1261
|
+
rule: "Each tab has aria-controls referring to its panel.",
|
|
1262
|
+
target: { part: "tab", at: "selected" },
|
|
1263
|
+
attribute: "aria-controls",
|
|
1264
|
+
references: "panel"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
id: "panel-labelled-by-tab",
|
|
1268
|
+
requirement: "required",
|
|
1269
|
+
rule: "Each panel has aria-labelledby referring to its tab.",
|
|
1270
|
+
target: { part: "panel" },
|
|
1271
|
+
attribute: "aria-labelledby",
|
|
1272
|
+
references: "tab"
|
|
1273
|
+
}
|
|
1274
|
+
],
|
|
1275
|
+
keyboard: [
|
|
1276
|
+
{
|
|
1277
|
+
id: "tab-enters-at-selected",
|
|
1278
|
+
key: "Tab",
|
|
1279
|
+
keys: "{Tab}",
|
|
1280
|
+
requirement: "required",
|
|
1281
|
+
given: { focus: "page-start" },
|
|
1282
|
+
result: "When focus moves into the tab list, it lands on the selected tab.",
|
|
1283
|
+
then: { focus: { part: "tab", at: "selected" } }
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
id: "tab-leaves-to-panel",
|
|
1287
|
+
key: "Tab",
|
|
1288
|
+
keys: "{Tab}",
|
|
1289
|
+
requirement: "required",
|
|
1290
|
+
given: { focus: { part: "tab", at: "selected" } },
|
|
1291
|
+
result: "From the tab list, Tab moves focus to the next element in the page: the panel.",
|
|
1292
|
+
then: { focus: { part: "panel" } }
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
id: "right-arrow-next",
|
|
1296
|
+
key: "Right Arrow",
|
|
1297
|
+
keys: "{ArrowRight}",
|
|
1298
|
+
requirement: "required",
|
|
1299
|
+
given: { focus: { part: "tab", at: "first" }, attributes: [selected2("first")] },
|
|
1300
|
+
result: "Moves focus to the next tab.",
|
|
1301
|
+
then: { focus: { part: "tab", at: 1 } }
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
id: "right-arrow-selects",
|
|
1305
|
+
key: "Right Arrow",
|
|
1306
|
+
keys: "{ArrowRight}",
|
|
1307
|
+
requirement: "required",
|
|
1308
|
+
when: { activation: "automatic" },
|
|
1309
|
+
given: { focus: { part: "tab", at: "first" }, attributes: [selected2("first")] },
|
|
1310
|
+
result: "With automatic activation, the tab that receives focus is selected.",
|
|
1311
|
+
then: { focus: { part: "tab", at: 1 }, attributes: [selected2(1)] }
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
id: "right-arrow-keeps-selection",
|
|
1315
|
+
key: "Right Arrow",
|
|
1316
|
+
keys: "{ArrowRight}",
|
|
1317
|
+
requirement: "required",
|
|
1318
|
+
when: { activation: "manual" },
|
|
1319
|
+
given: { focus: { part: "tab", at: "first" }, attributes: [selected2("first")] },
|
|
1320
|
+
result: "With manual activation, moving focus does not change the selected tab.",
|
|
1321
|
+
then: { focus: { part: "tab", at: 1 }, attributes: [selected2("first")] }
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
id: "right-arrow-wraps",
|
|
1325
|
+
key: "Right Arrow",
|
|
1326
|
+
keys: "{ArrowRight}",
|
|
1327
|
+
requirement: "required",
|
|
1328
|
+
given: { focus: { part: "tab", at: "last" } },
|
|
1329
|
+
result: "On the last tab, moves focus to the first tab.",
|
|
1330
|
+
then: { focus: { part: "tab", at: "first" } }
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
id: "left-arrow-previous",
|
|
1334
|
+
key: "Left Arrow",
|
|
1335
|
+
keys: "{ArrowLeft}",
|
|
1336
|
+
requirement: "required",
|
|
1337
|
+
given: { focus: { part: "tab", at: 1 } },
|
|
1338
|
+
result: "Moves focus to the previous tab.",
|
|
1339
|
+
then: { focus: { part: "tab", at: "first" } }
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
id: "left-arrow-wraps",
|
|
1343
|
+
key: "Left Arrow",
|
|
1344
|
+
keys: "{ArrowLeft}",
|
|
1345
|
+
requirement: "required",
|
|
1346
|
+
given: { focus: { part: "tab", at: "first" } },
|
|
1347
|
+
result: "On the first tab, moves focus to the last tab.",
|
|
1348
|
+
then: { focus: { part: "tab", at: "last" } }
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
id: "home-first",
|
|
1352
|
+
key: "Home",
|
|
1353
|
+
keys: "{Home}",
|
|
1354
|
+
requirement: "optional",
|
|
1355
|
+
given: { focus: { part: "tab", at: "last" } },
|
|
1356
|
+
result: "Moves focus to the first tab.",
|
|
1357
|
+
then: { focus: { part: "tab", at: "first" } }
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
id: "end-last",
|
|
1361
|
+
key: "End",
|
|
1362
|
+
keys: "{End}",
|
|
1363
|
+
requirement: "optional",
|
|
1364
|
+
given: { focus: { part: "tab", at: "first" } },
|
|
1365
|
+
result: "Moves focus to the last tab.",
|
|
1366
|
+
then: { focus: { part: "tab", at: "last" } }
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
id: "enter-selects",
|
|
1370
|
+
key: "Enter",
|
|
1371
|
+
keys: "{Enter}",
|
|
1372
|
+
requirement: "required",
|
|
1373
|
+
when: { activation: "manual" },
|
|
1374
|
+
given: { focus: { part: "tab", at: 1 }, attributes: [selected2("first")] },
|
|
1375
|
+
result: "Selects the focused tab and shows its panel.",
|
|
1376
|
+
then: { focus: { part: "tab", at: 1 }, attributes: [selected2(1)] }
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
id: "space-selects",
|
|
1380
|
+
key: "Space",
|
|
1381
|
+
keys: "{ }",
|
|
1382
|
+
requirement: "required",
|
|
1383
|
+
when: { activation: "manual" },
|
|
1384
|
+
given: { focus: { part: "tab", at: 1 }, attributes: [selected2("first")] },
|
|
1385
|
+
result: "Selects the focused tab and shows its panel.",
|
|
1386
|
+
then: { focus: { part: "tab", at: 1 }, attributes: [selected2(1)] }
|
|
1387
|
+
}
|
|
1388
|
+
],
|
|
1389
|
+
ios: {
|
|
1390
|
+
parts: {
|
|
1391
|
+
tab: {
|
|
1392
|
+
description: "A segment of the segmented picker above the content: a button named by its label; the shown section is selected.",
|
|
1393
|
+
name: "required",
|
|
1394
|
+
type: "button"
|
|
1395
|
+
},
|
|
1396
|
+
panel: {
|
|
1397
|
+
description: "Text of the selected section's content.",
|
|
1398
|
+
name: "required",
|
|
1399
|
+
type: "staticText"
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
structure: [
|
|
1403
|
+
{ target: { part: "tab", label: "Overview" }, selected: true },
|
|
1404
|
+
{ target: { part: "tab", label: "Activity" }, selected: false },
|
|
1405
|
+
{ target: { part: "panel", label: "Project summary and current status." }, exists: true }
|
|
1406
|
+
],
|
|
1407
|
+
interactions: [
|
|
1408
|
+
{
|
|
1409
|
+
id: "activation-selects-tab",
|
|
1410
|
+
action: "tap",
|
|
1411
|
+
on: { part: "tab", label: "Activity" },
|
|
1412
|
+
result: "Selects the tab and shows its content in place of the previous one.",
|
|
1413
|
+
then: [
|
|
1414
|
+
{ target: { part: "tab", label: "Activity" }, selected: true },
|
|
1415
|
+
{ target: { part: "tab", label: "Overview" }, selected: false },
|
|
1416
|
+
{ target: { part: "panel", label: "Recent project changes." }, exists: true },
|
|
1417
|
+
{
|
|
1418
|
+
target: { part: "panel", label: "Project summary and current status." },
|
|
1419
|
+
exists: false
|
|
1420
|
+
}
|
|
1421
|
+
]
|
|
1422
|
+
}
|
|
1423
|
+
]
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
// src/a11y/index.ts
|
|
1428
|
+
var a11yPatterns = {
|
|
1429
|
+
accordion: accordionPattern,
|
|
1430
|
+
alertdialog: alertDialogPattern,
|
|
1431
|
+
checkbox: checkboxPattern,
|
|
1432
|
+
"combobox-select-only": comboboxSelectOnlyPattern,
|
|
1433
|
+
"dialog-modal": dialogModalPattern,
|
|
1434
|
+
"menu-button": menuButtonPattern,
|
|
1435
|
+
radio: radioPattern,
|
|
1436
|
+
switch: switchPattern,
|
|
1437
|
+
tabs: tabsPattern
|
|
1438
|
+
};
|
|
1439
|
+
function getA11yPattern(id) {
|
|
1440
|
+
return a11yPatterns[id];
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
export { a11yPatterns, accordionPattern, alertDialogPattern, checkboxPattern, comboboxSelectOnlyPattern, dialogModalPattern, getA11yPattern, menuButtonPattern, radioPattern, switchPattern, tabsPattern };
|
|
1444
|
+
//# sourceMappingURL=chunk-Y4V7OWL4.js.map
|
|
1445
|
+
//# sourceMappingURL=chunk-Y4V7OWL4.js.map
|