@selenium/atoms 4.51.0 → 4.53.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.
- package/README.md +56 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/typescript/accessibility-snapshot-wire.d.ts +4 -0
- package/dist/typescript/accessibility-snapshot-wire.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot-wire.js +18 -0
- package/dist/typescript/accessibility-snapshot-wire.js.map +1 -0
- package/dist/typescript/accessibility-snapshot.d.ts +3 -0
- package/dist/typescript/accessibility-snapshot.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot.js +18 -0
- package/dist/typescript/accessibility-snapshot.js.map +1 -0
- package/dist/typescript/active-element.d.ts +2 -0
- package/dist/typescript/active-element.d.ts.map +1 -0
- package/dist/typescript/active-element.js +19 -0
- package/dist/typescript/active-element.js.map +1 -0
- package/dist/typescript/clear-local-storage.d.ts +3 -0
- package/dist/typescript/clear-local-storage.d.ts.map +1 -0
- package/dist/typescript/clear-local-storage.js +25 -0
- package/dist/typescript/clear-local-storage.js.map +1 -0
- package/dist/typescript/clear-session-storage.d.ts +3 -0
- package/dist/typescript/clear-session-storage.d.ts.map +1 -0
- package/dist/typescript/clear-session-storage.js +25 -0
- package/dist/typescript/clear-session-storage.js.map +1 -0
- package/dist/typescript/clear.d.ts +3 -0
- package/dist/typescript/clear.d.ts.map +1 -0
- package/dist/typescript/clear.js +67 -0
- package/dist/typescript/clear.js.map +1 -0
- package/dist/typescript/click.d.ts +4 -0
- package/dist/typescript/click.d.ts.map +1 -0
- package/dist/typescript/click.js +52 -0
- package/dist/typescript/click.js.map +1 -0
- package/dist/typescript/core/accessibility/accname.d.ts +6 -0
- package/dist/typescript/core/accessibility/accname.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/accname.js +537 -0
- package/dist/typescript/core/accessibility/accname.js.map +1 -0
- package/dist/typescript/core/accessibility/context.d.ts +43 -0
- package/dist/typescript/core/accessibility/context.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/context.js +49 -0
- package/dist/typescript/core/accessibility/context.js.map +1 -0
- package/dist/typescript/core/accessibility/hidden.d.ts +39 -0
- package/dist/typescript/core/accessibility/hidden.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/hidden.js +216 -0
- package/dist/typescript/core/accessibility/hidden.js.map +1 -0
- package/dist/typescript/core/accessibility/roles.d.ts +28 -0
- package/dist/typescript/core/accessibility/roles.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/roles.js +381 -0
- package/dist/typescript/core/accessibility/roles.js.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts +13 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.js +55 -0
- package/dist/typescript/core/accessibility/snapshot.js.map +1 -0
- package/dist/typescript/core/accessibility/states.d.ts +18 -0
- package/dist/typescript/core/accessibility/states.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/states.js +215 -0
- package/dist/typescript/core/accessibility/states.js.map +1 -0
- package/dist/typescript/core/accessibility/tree.d.ts +10 -0
- package/dist/typescript/core/accessibility/tree.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/tree.js +261 -0
- package/dist/typescript/core/accessibility/tree.js.map +1 -0
- package/dist/typescript/core/accessibility/types.d.ts +30 -0
- package/dist/typescript/core/accessibility/types.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/types.js +18 -0
- package/dist/typescript/core/accessibility/types.js.map +1 -0
- package/dist/typescript/core/accessibility/value.d.ts +4 -0
- package/dist/typescript/core/accessibility/value.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/value.js +83 -0
- package/dist/typescript/core/accessibility/value.js.map +1 -0
- package/dist/typescript/core/accessibility/wire.d.ts +57 -0
- package/dist/typescript/core/accessibility/wire.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/wire.js +72 -0
- package/dist/typescript/core/accessibility/wire.js.map +1 -0
- package/dist/typescript/core/attribute.d.ts +3 -0
- package/dist/typescript/core/attribute.d.ts.map +1 -0
- package/dist/typescript/core/attribute.js +60 -0
- package/dist/typescript/core/attribute.js.map +1 -0
- package/dist/typescript/core/color.d.ts +2 -0
- package/dist/typescript/core/color.d.ts.map +1 -0
- package/dist/typescript/core/color.js +248 -0
- package/dist/typescript/core/color.js.map +1 -0
- package/dist/typescript/core/editable.d.ts +5 -0
- package/dist/typescript/core/editable.d.ts.map +1 -0
- package/dist/typescript/core/editable.js +55 -0
- package/dist/typescript/core/editable.js.map +1 -0
- package/dist/typescript/core/element.d.ts +6 -0
- package/dist/typescript/core/element.d.ts.map +1 -0
- package/dist/typescript/core/element.js +97 -0
- package/dist/typescript/core/element.js.map +1 -0
- package/dist/typescript/core/enabled.d.ts +2 -0
- package/dist/typescript/core/enabled.d.ts.map +1 -0
- package/dist/typescript/core/enabled.js +69 -0
- package/dist/typescript/core/enabled.js.map +1 -0
- package/dist/typescript/core/error.d.ts +13 -0
- package/dist/typescript/core/error.d.ts.map +1 -0
- package/dist/typescript/core/error.js +40 -0
- package/dist/typescript/core/error.js.map +1 -0
- package/dist/typescript/core/events.d.ts +91 -0
- package/dist/typescript/core/events.d.ts.map +1 -0
- package/dist/typescript/core/events.js +131 -0
- package/dist/typescript/core/events.js.map +1 -0
- package/dist/typescript/core/focus.d.ts +4 -0
- package/dist/typescript/core/focus.d.ts.map +1 -0
- package/dist/typescript/core/focus.js +88 -0
- package/dist/typescript/core/focus.js.map +1 -0
- package/dist/typescript/core/focusable.d.ts +2 -0
- package/dist/typescript/core/focusable.d.ts.map +1 -0
- package/dist/typescript/core/focusable.js +36 -0
- package/dist/typescript/core/focusable.js.map +1 -0
- package/dist/typescript/core/form.d.ts +2 -0
- package/dist/typescript/core/form.d.ts.map +1 -0
- package/dist/typescript/core/form.js +76 -0
- package/dist/typescript/core/form.js.map +1 -0
- package/dist/typescript/core/frame.d.ts +8 -0
- package/dist/typescript/core/frame.d.ts.map +1 -0
- package/dist/typescript/core/frame.js +95 -0
- package/dist/typescript/core/frame.js.map +1 -0
- package/dist/typescript/core/geometry.d.ts +28 -0
- package/dist/typescript/core/geometry.d.ts.map +1 -0
- package/dist/typescript/core/geometry.js +134 -0
- package/dist/typescript/core/geometry.js.map +1 -0
- package/dist/typescript/core/inject.d.ts +21 -0
- package/dist/typescript/core/inject.d.ts.map +1 -0
- package/dist/typescript/core/inject.js +282 -0
- package/dist/typescript/core/inject.js.map +1 -0
- package/dist/typescript/core/interactable.d.ts +2 -0
- package/dist/typescript/core/interactable.d.ts.map +1 -0
- package/dist/typescript/core/interactable.js +27 -0
- package/dist/typescript/core/interactable.js.map +1 -0
- package/dist/typescript/core/keyboard.d.ts +15 -0
- package/dist/typescript/core/keyboard.d.ts.map +1 -0
- package/dist/typescript/core/keyboard.js +356 -0
- package/dist/typescript/core/keyboard.js.map +1 -0
- package/dist/typescript/core/keys.d.ts +65 -0
- package/dist/typescript/core/keys.d.ts.map +1 -0
- package/dist/typescript/core/keys.js +125 -0
- package/dist/typescript/core/keys.js.map +1 -0
- package/dist/typescript/core/locators.d.ts +6 -0
- package/dist/typescript/core/locators.d.ts.map +1 -0
- package/dist/typescript/core/locators.js +610 -0
- package/dist/typescript/core/locators.js.map +1 -0
- package/dist/typescript/core/mouse.d.ts +17 -0
- package/dist/typescript/core/mouse.d.ts.map +1 -0
- package/dist/typescript/core/mouse.js +186 -0
- package/dist/typescript/core/mouse.js.map +1 -0
- package/dist/typescript/core/overflow.d.ts +5 -0
- package/dist/typescript/core/overflow.d.ts.map +1 -0
- package/dist/typescript/core/overflow.js +133 -0
- package/dist/typescript/core/overflow.js.map +1 -0
- package/dist/typescript/core/scroll.d.ts +3 -0
- package/dist/typescript/core/scroll.d.ts.map +1 -0
- package/dist/typescript/core/scroll.js +77 -0
- package/dist/typescript/core/scroll.js.map +1 -0
- package/dist/typescript/core/shown.d.ts +3 -0
- package/dist/typescript/core/shown.d.ts.map +1 -0
- package/dist/typescript/core/shown.js +190 -0
- package/dist/typescript/core/shown.js.map +1 -0
- package/dist/typescript/core/storage.d.ts +14 -0
- package/dist/typescript/core/storage.d.ts.map +1 -0
- package/dist/typescript/core/storage.js +98 -0
- package/dist/typescript/core/storage.js.map +1 -0
- package/dist/typescript/core/style.d.ts +2 -0
- package/dist/typescript/core/style.d.ts.map +1 -0
- package/dist/typescript/core/style.js +32 -0
- package/dist/typescript/core/style.js.map +1 -0
- package/dist/typescript/core/useragent.d.ts +3 -0
- package/dist/typescript/core/useragent.d.ts.map +1 -0
- package/dist/typescript/core/useragent.js +31 -0
- package/dist/typescript/core/useragent.js.map +1 -0
- package/dist/typescript/default-content.d.ts +2 -0
- package/dist/typescript/default-content.d.ts.map +1 -0
- package/dist/typescript/default-content.js +20 -0
- package/dist/typescript/default-content.js.map +1 -0
- package/dist/typescript/execute-async-script.d.ts +2 -0
- package/dist/typescript/execute-async-script.d.ts.map +1 -0
- package/dist/typescript/execute-async-script.js +20 -0
- package/dist/typescript/execute-async-script.js.map +1 -0
- package/dist/typescript/execute-script.d.ts +2 -0
- package/dist/typescript/execute-script.d.ts.map +1 -0
- package/dist/typescript/execute-script.js +20 -0
- package/dist/typescript/execute-script.js.map +1 -0
- package/dist/typescript/find-element-fragment.d.ts +8 -0
- package/dist/typescript/find-element-fragment.d.ts.map +1 -0
- package/dist/typescript/find-element-fragment.js +39 -0
- package/dist/typescript/find-element-fragment.js.map +1 -0
- package/dist/typescript/find-element.d.ts +2 -0
- package/dist/typescript/find-element.d.ts.map +1 -0
- package/dist/typescript/find-element.js +18 -0
- package/dist/typescript/find-element.js.map +1 -0
- package/dist/typescript/find-elements.d.ts +1 -2
- package/dist/typescript/find-elements.d.ts.map +1 -1
- package/dist/typescript/find-elements.js +1 -289
- package/dist/typescript/find-elements.js.map +1 -1
- package/dist/typescript/frame-by-id-or-name.d.ts +2 -0
- package/dist/typescript/frame-by-id-or-name.d.ts.map +1 -0
- package/dist/typescript/frame-by-id-or-name.js +22 -0
- package/dist/typescript/frame-by-id-or-name.js.map +1 -0
- package/dist/typescript/frame-by-index.d.ts +2 -0
- package/dist/typescript/frame-by-index.d.ts.map +1 -0
- package/dist/typescript/frame-by-index.js +19 -0
- package/dist/typescript/frame-by-index.js.map +1 -0
- package/dist/typescript/get-attribute-value.d.ts +2 -0
- package/dist/typescript/get-attribute-value.d.ts.map +1 -0
- package/dist/typescript/get-attribute-value.js +22 -0
- package/dist/typescript/get-attribute-value.js.map +1 -0
- package/dist/typescript/get-effective-style.d.ts +3 -0
- package/dist/typescript/get-effective-style.d.ts.map +1 -0
- package/dist/typescript/get-effective-style.js +84 -0
- package/dist/typescript/get-effective-style.js.map +1 -0
- package/dist/typescript/get-element-from-cache.d.ts +2 -0
- package/dist/typescript/get-element-from-cache.d.ts.map +1 -0
- package/dist/typescript/get-element-from-cache.js +20 -0
- package/dist/typescript/get-element-from-cache.js.map +1 -0
- package/dist/typescript/get-frame-window.d.ts +2 -0
- package/dist/typescript/get-frame-window.d.ts.map +1 -0
- package/dist/typescript/get-frame-window.js +22 -0
- package/dist/typescript/get-frame-window.js.map +1 -0
- package/dist/typescript/get-local-storage-item.d.ts +3 -0
- package/dist/typescript/get-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-item.js +25 -0
- package/dist/typescript/get-local-storage-item.js.map +1 -0
- package/dist/typescript/get-local-storage-key.d.ts +3 -0
- package/dist/typescript/get-local-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-key.js +26 -0
- package/dist/typescript/get-local-storage-key.js.map +1 -0
- package/dist/typescript/get-local-storage-keys.d.ts +3 -0
- package/dist/typescript/get-local-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-keys.js +25 -0
- package/dist/typescript/get-local-storage-keys.js.map +1 -0
- package/dist/typescript/get-local-storage-size.d.ts +3 -0
- package/dist/typescript/get-local-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-size.js +25 -0
- package/dist/typescript/get-local-storage-size.js.map +1 -0
- package/dist/typescript/get-location.d.ts +9 -0
- package/dist/typescript/get-location.d.ts.map +1 -0
- package/dist/typescript/get-location.js +49 -0
- package/dist/typescript/get-location.js.map +1 -0
- package/dist/typescript/get-session-storage-item.d.ts +3 -0
- package/dist/typescript/get-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-item.js +25 -0
- package/dist/typescript/get-session-storage-item.js.map +1 -0
- package/dist/typescript/get-session-storage-key.d.ts +3 -0
- package/dist/typescript/get-session-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-key.js +26 -0
- package/dist/typescript/get-session-storage-key.js.map +1 -0
- package/dist/typescript/get-session-storage-keys.d.ts +3 -0
- package/dist/typescript/get-session-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-keys.js +25 -0
- package/dist/typescript/get-session-storage-keys.js.map +1 -0
- package/dist/typescript/get-session-storage-size.d.ts +3 -0
- package/dist/typescript/get-session-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-size.js +25 -0
- package/dist/typescript/get-session-storage-size.js.map +1 -0
- package/dist/typescript/get-size.d.ts +7 -0
- package/dist/typescript/get-size.d.ts.map +1 -0
- package/dist/typescript/get-size.js +36 -0
- package/dist/typescript/get-size.js.map +1 -0
- package/dist/typescript/get-text.d.ts +3 -0
- package/dist/typescript/get-text.d.ts.map +1 -0
- package/dist/typescript/get-text.js +294 -0
- package/dist/typescript/get-text.js.map +1 -0
- package/dist/typescript/get-top-left-coordinates.d.ts +4 -0
- package/dist/typescript/get-top-left-coordinates.d.ts.map +1 -0
- package/dist/typescript/get-top-left-coordinates.js +36 -0
- package/dist/typescript/get-top-left-coordinates.js.map +1 -0
- package/dist/typescript/is-displayed.d.ts +1 -2
- package/dist/typescript/is-displayed.d.ts.map +1 -1
- package/dist/typescript/is-displayed.js +3 -396
- package/dist/typescript/is-displayed.js.map +1 -1
- package/dist/typescript/is-editable.d.ts +2 -0
- package/dist/typescript/is-editable.d.ts.map +1 -0
- package/dist/typescript/is-editable.js +18 -0
- package/dist/typescript/is-editable.js.map +1 -0
- package/dist/typescript/is-enabled.d.ts +2 -0
- package/dist/typescript/is-enabled.d.ts.map +1 -0
- package/dist/typescript/is-enabled.js +18 -0
- package/dist/typescript/is-enabled.js.map +1 -0
- package/dist/typescript/is-focusable.d.ts +2 -0
- package/dist/typescript/is-focusable.d.ts.map +1 -0
- package/dist/typescript/is-focusable.js +20 -0
- package/dist/typescript/is-focusable.js.map +1 -0
- package/dist/typescript/is-interactable.d.ts +2 -0
- package/dist/typescript/is-interactable.d.ts.map +1 -0
- package/dist/typescript/is-interactable.js +19 -0
- package/dist/typescript/is-interactable.js.map +1 -0
- package/dist/typescript/is-selected.d.ts +3 -0
- package/dist/typescript/is-selected.d.ts.map +1 -0
- package/dist/typescript/is-selected.js +29 -0
- package/dist/typescript/is-selected.js.map +1 -0
- package/dist/typescript/remove-local-storage-item.d.ts +3 -0
- package/dist/typescript/remove-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-local-storage-item.js +25 -0
- package/dist/typescript/remove-local-storage-item.js.map +1 -0
- package/dist/typescript/remove-session-storage-item.d.ts +3 -0
- package/dist/typescript/remove-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-session-storage-item.js +25 -0
- package/dist/typescript/remove-session-storage-item.js.map +1 -0
- package/dist/typescript/set-local-storage-item.d.ts +3 -0
- package/dist/typescript/set-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-local-storage-item.js +26 -0
- package/dist/typescript/set-local-storage-item.js.map +1 -0
- package/dist/typescript/set-session-storage-item.d.ts +3 -0
- package/dist/typescript/set-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-session-storage-item.js +26 -0
- package/dist/typescript/set-session-storage-item.js.map +1 -0
- package/dist/typescript/submit.d.ts +3 -0
- package/dist/typescript/submit.d.ts.map +1 -0
- package/dist/typescript/submit.js +50 -0
- package/dist/typescript/submit.js.map +1 -0
- package/dist/typescript/type.d.ts +3 -0
- package/dist/typescript/type.d.ts.map +1 -0
- package/dist/typescript/type.js +201 -0
- package/dist/typescript/type.js.map +1 -0
- package/index.ts +44 -0
- package/package.json +306 -5
- package/typescript/accessibility-snapshot-wire.ts +20 -0
- package/typescript/accessibility-snapshot.ts +21 -0
- package/typescript/active-element.ts +19 -0
- package/typescript/clear-local-storage.ts +27 -0
- package/typescript/clear-session-storage.ts +27 -0
- package/typescript/clear.ts +73 -0
- package/typescript/click.ts +55 -0
- package/typescript/core/accessibility/accname.ts +587 -0
- package/typescript/core/accessibility/context.ts +116 -0
- package/typescript/core/accessibility/hidden.ts +242 -0
- package/typescript/core/accessibility/roles.ts +410 -0
- package/typescript/core/accessibility/snapshot.ts +61 -0
- package/typescript/core/accessibility/states.ts +233 -0
- package/typescript/core/accessibility/tree.ts +306 -0
- package/typescript/core/accessibility/types.ts +52 -0
- package/typescript/core/accessibility/value.ts +89 -0
- package/typescript/core/accessibility/wire.ts +123 -0
- package/typescript/core/attribute.ts +68 -0
- package/typescript/core/color.ts +257 -0
- package/typescript/core/editable.ts +63 -0
- package/typescript/core/element.ts +110 -0
- package/typescript/core/enabled.ts +76 -0
- package/typescript/core/error.ts +41 -0
- package/typescript/core/events.ts +268 -0
- package/typescript/core/focus.ts +92 -0
- package/typescript/core/focusable.ts +38 -0
- package/typescript/core/form.ts +81 -0
- package/typescript/core/frame.ts +105 -0
- package/typescript/core/geometry.ts +183 -0
- package/typescript/core/inject.ts +336 -0
- package/typescript/core/interactable.ts +30 -0
- package/typescript/core/keyboard.ts +369 -0
- package/typescript/core/keys.ts +204 -0
- package/typescript/core/locators.ts +704 -0
- package/typescript/core/mouse.ts +211 -0
- package/typescript/core/overflow.ts +172 -0
- package/typescript/core/scroll.ts +92 -0
- package/typescript/core/shown.ts +233 -0
- package/typescript/core/storage.ts +111 -0
- package/typescript/core/style.ts +32 -0
- package/typescript/core/useragent.ts +33 -0
- package/typescript/default-content.ts +20 -0
- package/typescript/execute-async-script.ts +20 -0
- package/typescript/execute-script.ts +20 -0
- package/typescript/find-element-fragment.ts +45 -0
- package/typescript/find-element.ts +18 -0
- package/typescript/find-elements.ts +1 -326
- package/typescript/frame-by-id-or-name.ts +22 -0
- package/typescript/frame-by-index.ts +19 -0
- package/typescript/get-attribute-value.ts +22 -0
- package/typescript/get-effective-style.ts +93 -0
- package/typescript/get-element-from-cache.ts +20 -0
- package/typescript/get-frame-window.ts +22 -0
- package/typescript/get-local-storage-item.ts +27 -0
- package/typescript/get-local-storage-key.ts +28 -0
- package/typescript/get-local-storage-keys.ts +27 -0
- package/typescript/get-local-storage-size.ts +27 -0
- package/typescript/get-location.ts +63 -0
- package/typescript/get-session-storage-item.ts +27 -0
- package/typescript/get-session-storage-key.ts +28 -0
- package/typescript/get-session-storage-keys.ts +27 -0
- package/typescript/get-session-storage-size.ts +27 -0
- package/typescript/get-size.ts +43 -0
- package/typescript/get-text.ts +353 -0
- package/typescript/get-top-left-coordinates.ts +38 -0
- package/typescript/is-displayed.ts +3 -498
- package/typescript/is-editable.ts +18 -0
- package/typescript/is-enabled.ts +18 -0
- package/typescript/is-focusable.ts +20 -0
- package/typescript/is-interactable.ts +19 -0
- package/typescript/is-selected.ts +31 -0
- package/typescript/remove-local-storage-item.ts +27 -0
- package/typescript/remove-session-storage-item.ts +27 -0
- package/typescript/set-local-storage-item.ts +28 -0
- package/typescript/set-session-storage-item.ts +28 -0
- package/typescript/submit.ts +53 -0
- package/typescript/type.ts +210 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
import { isEnabled } from '../enabled.js';
|
|
18
|
+
import { canTakeFocus } from './roles.js';
|
|
19
|
+
import { embeddedValue } from './value.js';
|
|
20
|
+
// The `states` map and `value` field of ADR 18205 §2. Which keys appear:
|
|
21
|
+
//
|
|
22
|
+
// checked whenever the role supports it; "mixed" where the role allows it
|
|
23
|
+
// pressed when the element sets aria-pressed: a button without it is not
|
|
24
|
+
// a toggle button, so reporting pressed=false would mislead
|
|
25
|
+
// expanded when the element sets aria-expanded, and on a summary from its
|
|
26
|
+
// details' open state
|
|
27
|
+
// selected always for option, tab and treeitem, where selection is part of
|
|
28
|
+
// the role; for gridcell, row and headers only when the element
|
|
29
|
+
// sets aria-selected, since most grids are not selectable
|
|
30
|
+
// level always for headings (tag, aria-level, or ARIA's default of 2);
|
|
31
|
+
// elsewhere when the element sets aria-level
|
|
32
|
+
// disabled true only when disabled, natively or through aria-disabled on
|
|
33
|
+
// the element, or on an ancestor when the element can take focus
|
|
34
|
+
// (WAI-ARIA 1.2: the state reaches focusable descendants)
|
|
35
|
+
// focused true only on the focused element
|
|
36
|
+
//
|
|
37
|
+
// For pressed, expanded and the grid parts' selected, "undefined" and an
|
|
38
|
+
// empty value mean the attribute is not set: ARIA defines undefined as "not
|
|
39
|
+
// a toggle", "not expandable", "not selectable".
|
|
40
|
+
//
|
|
41
|
+
// Adding a key is additive under the ADR's compatibility rule; the states
|
|
42
|
+
// page pins the current set.
|
|
43
|
+
const CHECKED_ROLES = new Set(['checkbox', 'menuitemcheckbox', 'menuitemradio', 'radio', 'switch']);
|
|
44
|
+
const MIXED_ALLOWED = new Set(['checkbox', 'menuitemcheckbox']);
|
|
45
|
+
const ALWAYS_SELECTED_ROLES = new Set(['option', 'tab', 'treeitem']);
|
|
46
|
+
const SELECTABLE_ROLES = new Set(['columnheader', 'gridcell', 'row', 'rowheader']);
|
|
47
|
+
const LEVEL_ROLES = new Set(['comment', 'listitem', 'row', 'tablist', 'treeitem']);
|
|
48
|
+
const VALUE_ROLES = new Set([
|
|
49
|
+
'combobox', 'meter', 'progressbar', 'scrollbar', 'searchbox', 'slider', 'spinbutton', 'textbox',
|
|
50
|
+
]);
|
|
51
|
+
// The elements core/enabled.ts can report as disabled; for anything else it
|
|
52
|
+
// answers enabled without looking, so it is not asked.
|
|
53
|
+
const DISABLEABLE_ELEMENTS = new Set(['button', 'input', 'optgroup', 'option', 'select', 'textarea']);
|
|
54
|
+
function token(element, name) {
|
|
55
|
+
const value = element.getAttribute(name);
|
|
56
|
+
return value === null ? null : value.trim().toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
// A token whose "undefined" and empty values count as the attribute being absent.
|
|
59
|
+
function optionalToken(element, name) {
|
|
60
|
+
const value = token(element, name);
|
|
61
|
+
return value === '' || value === 'undefined' ? null : value;
|
|
62
|
+
}
|
|
63
|
+
function tristate(element, name, allowMixed) {
|
|
64
|
+
const value = token(element, name);
|
|
65
|
+
if (value === 'true') {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (value === 'mixed' && allowMixed) {
|
|
69
|
+
return 'mixed';
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
function checked(element, role) {
|
|
74
|
+
if (element.localName === 'input') {
|
|
75
|
+
const input = element;
|
|
76
|
+
if (input.type === 'checkbox' || input.type === 'radio') {
|
|
77
|
+
return input.indeterminate && MIXED_ALLOWED.has(role) ? 'mixed' : input.checked;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return tristate(element, 'aria-checked', MIXED_ALLOWED.has(role));
|
|
81
|
+
}
|
|
82
|
+
function expanded(element) {
|
|
83
|
+
const value = optionalToken(element, 'aria-expanded');
|
|
84
|
+
if (value !== null) {
|
|
85
|
+
return value === 'true';
|
|
86
|
+
}
|
|
87
|
+
if (element.localName === 'summary') {
|
|
88
|
+
const details = element.parentElement;
|
|
89
|
+
if (details && details.localName === 'details') {
|
|
90
|
+
return details.hasAttribute('open');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function selected(element, role) {
|
|
96
|
+
if (element.localName === 'option' && role === 'option') {
|
|
97
|
+
return element.selected;
|
|
98
|
+
}
|
|
99
|
+
if (ALWAYS_SELECTED_ROLES.has(role)) {
|
|
100
|
+
return token(element, 'aria-selected') === 'true';
|
|
101
|
+
}
|
|
102
|
+
if (SELECTABLE_ROLES.has(role)) {
|
|
103
|
+
const value = optionalToken(element, 'aria-selected');
|
|
104
|
+
return value === null ? null : value === 'true';
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function ariaLevel(element) {
|
|
109
|
+
const value = element.getAttribute('aria-level');
|
|
110
|
+
if (value === null || !/^\s*\d+\s*$/.test(value)) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const level = parseInt(value, 10);
|
|
114
|
+
return level >= 1 ? level : null;
|
|
115
|
+
}
|
|
116
|
+
function level(element, role) {
|
|
117
|
+
if (role === 'heading') {
|
|
118
|
+
const explicit = ariaLevel(element);
|
|
119
|
+
if (explicit !== null) {
|
|
120
|
+
return explicit;
|
|
121
|
+
}
|
|
122
|
+
const tag = /^h([1-6])$/.exec(element.localName);
|
|
123
|
+
return tag ? Number(tag[1]) : 2;
|
|
124
|
+
}
|
|
125
|
+
return LEVEL_ROLES.has(role) ? ariaLevel(element) : null;
|
|
126
|
+
}
|
|
127
|
+
/** Whether the element itself sets aria-disabled=true. */
|
|
128
|
+
export function setsAriaDisabled(element) {
|
|
129
|
+
return token(element, 'aria-disabled') === 'true';
|
|
130
|
+
}
|
|
131
|
+
// The DOM parent, or the host for a shadow root's child: aria-disabled on
|
|
132
|
+
// a host reaches into its shadow tree.
|
|
133
|
+
function parentOrHost(element) {
|
|
134
|
+
if (element.parentElement) {
|
|
135
|
+
return element.parentElement;
|
|
136
|
+
}
|
|
137
|
+
return element.getRootNode().host || null;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Whether an ancestor sets aria-disabled. The walk threads that down, so
|
|
141
|
+
* this check is only for a root or an owned element, whose ancestors the
|
|
142
|
+
* walk has not seen.
|
|
143
|
+
*/
|
|
144
|
+
export function isDisabledByAncestor(element) {
|
|
145
|
+
for (let current = parentOrHost(element); current; current = parentOrHost(current)) {
|
|
146
|
+
if (setsAriaDisabled(current)) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
// An ancestor's aria-disabled reaches the descendants that can take focus
|
|
153
|
+
// (WAI-ARIA 1.2), not the headings and paragraphs between them.
|
|
154
|
+
function disabled(element, disabledByAncestor) {
|
|
155
|
+
if (setsAriaDisabled(element) || (disabledByAncestor && canTakeFocus(element))) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return DISABLEABLE_ELEMENTS.has(element.localName) && !isEnabled(element);
|
|
159
|
+
}
|
|
160
|
+
// The body is the default active element and is not "focused" in any sense a
|
|
161
|
+
// user would recognise. Focus inside a shadow tree is known to that tree's
|
|
162
|
+
// root; the document only knows the host, which is not itself focused while
|
|
163
|
+
// something it can see inside its shadow root is.
|
|
164
|
+
function focused(element) {
|
|
165
|
+
const doc = element.ownerDocument;
|
|
166
|
+
if (element === doc.body || element === doc.documentElement) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
const root = element.getRootNode();
|
|
170
|
+
if (root.activeElement !== element) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
return !(element.shadowRoot && element.shadowRoot.activeElement);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The states map for an element with the given role; {} when there are none.
|
|
177
|
+
* `disabledByAncestor` is whether an ancestor sets aria-disabled, which the
|
|
178
|
+
* walk knows without climbing.
|
|
179
|
+
*/
|
|
180
|
+
export function computeStates(element, role, disabledByAncestor) {
|
|
181
|
+
const states = {};
|
|
182
|
+
if (CHECKED_ROLES.has(role)) {
|
|
183
|
+
states.checked = checked(element, role);
|
|
184
|
+
}
|
|
185
|
+
if (role === 'button') {
|
|
186
|
+
const pressed = optionalToken(element, 'aria-pressed');
|
|
187
|
+
if (pressed !== null) {
|
|
188
|
+
states.pressed = tristate(element, 'aria-pressed', true);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const isExpanded = expanded(element);
|
|
192
|
+
if (isExpanded !== null) {
|
|
193
|
+
states.expanded = isExpanded;
|
|
194
|
+
}
|
|
195
|
+
const isSelected = selected(element, role);
|
|
196
|
+
if (isSelected !== null) {
|
|
197
|
+
states.selected = isSelected;
|
|
198
|
+
}
|
|
199
|
+
const headingLevel = level(element, role);
|
|
200
|
+
if (headingLevel !== null) {
|
|
201
|
+
states.level = headingLevel;
|
|
202
|
+
}
|
|
203
|
+
if (disabled(element, disabledByAncestor)) {
|
|
204
|
+
states.disabled = true;
|
|
205
|
+
}
|
|
206
|
+
if (focused(element)) {
|
|
207
|
+
states.focused = true;
|
|
208
|
+
}
|
|
209
|
+
return states;
|
|
210
|
+
}
|
|
211
|
+
/** The current value for textbox, searchbox, combobox and range roles; null when the field is absent. */
|
|
212
|
+
export function computeValue(element, role) {
|
|
213
|
+
return VALUE_ROLES.has(role) ? embeddedValue(element, role) : null;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/states.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;A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,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;IACxB,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;IACvB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,IAAY;IACzD,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACpE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SnapshotContext } from './context.js';
|
|
2
|
+
import type { AccessibilityNode } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The snapshot rooted at `root`. The root always produces a node, whatever
|
|
5
|
+
* its role or hidden state, so a subtree snapshot of a plain div is still
|
|
6
|
+
* deterministic; a root whose subtree is hidden, by itself or by an
|
|
7
|
+
* ancestor, has no children.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildTree(root: Element, context: SnapshotContext): AccessibilityNode;
|
|
10
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/tree.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAU,eAAe,EAAE,MAAM,cAAc,CAAA;AAItD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AA8PnD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAuBpF"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
import { computeDescription, computeName } from './accname.js';
|
|
18
|
+
import { roleOf } from './context.js';
|
|
19
|
+
import { flatTreeChildren, hiddenState, isClosedDetails, isCollapsedDetailsContent, isHiddenByAncestor } from './hidden.js';
|
|
20
|
+
import { isPresentational } from './roles.js';
|
|
21
|
+
import { computeStates, computeValue, isDisabledByAncestor, setsAriaDisabled } from './states.js';
|
|
22
|
+
const ELEMENT_NODE = 1;
|
|
23
|
+
const TEXT_NODE = 3;
|
|
24
|
+
// WAI-ARIA 1.2 roles with "Children Presentational: True" (plus the graphics
|
|
25
|
+
// module's symbol). Their content only contributes to their name, never to
|
|
26
|
+
// the tree.
|
|
27
|
+
const CHILDREN_PRESENTATIONAL = new Set([
|
|
28
|
+
'button', 'checkbox', 'graphics-symbol', 'img', 'menuitemcheckbox', 'menuitemradio', 'meter',
|
|
29
|
+
'option', 'progressbar', 'radio', 'scrollbar', 'separator', 'slider', 'switch', 'tab',
|
|
30
|
+
]);
|
|
31
|
+
// Elements whose DOM children are not rendered content, whatever role they
|
|
32
|
+
// end up with: a frame's children are fallback for a browsing context only
|
|
33
|
+
// the bindings can reach (the ADR's iframe leaf), a textarea's text child is
|
|
34
|
+
// its default value, and media fallback shows only when the media cannot.
|
|
35
|
+
const LEAF_ELEMENTS = new Set(['audio', 'frame', 'iframe', 'textarea', 'video']);
|
|
36
|
+
function textLeaf(text) {
|
|
37
|
+
// No `element` or `value` key at all rather than undefined, so the
|
|
38
|
+
// serialized shape matches the schema literally.
|
|
39
|
+
return { role: 'text', name: text, description: '', states: {}, children: [] };
|
|
40
|
+
}
|
|
41
|
+
function elementNode(element, role, name, context, disabledByAncestor) {
|
|
42
|
+
const node = {
|
|
43
|
+
role,
|
|
44
|
+
name,
|
|
45
|
+
description: computeDescription(element, context),
|
|
46
|
+
states: computeStates(element, role, disabledByAncestor),
|
|
47
|
+
element,
|
|
48
|
+
children: [],
|
|
49
|
+
};
|
|
50
|
+
const value = computeValue(element, role);
|
|
51
|
+
if (value !== null) {
|
|
52
|
+
node.value = value;
|
|
53
|
+
}
|
|
54
|
+
const url = linkUrl(element, role);
|
|
55
|
+
if (url !== null) {
|
|
56
|
+
node.url = url;
|
|
57
|
+
}
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
61
|
+
// ADR 18205 §2: a link node carries the resolved href of an `a` or `area`
|
|
62
|
+
// element, as CDP's accessibility tree exposes it; an element made a link by
|
|
63
|
+
// role alone has nothing to resolve. The href property, not the attribute,
|
|
64
|
+
// so the URL is absolute. Checked by namespace and name rather than
|
|
65
|
+
// instanceof, which fails across realms when the atom runs in a sandbox.
|
|
66
|
+
function linkUrl(element, role) {
|
|
67
|
+
if (role !== 'link' || element.namespaceURI !== HTML_NAMESPACE) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const local = element.localName;
|
|
71
|
+
if ((local !== 'a' && local !== 'area') || !element.hasAttribute('href')) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return element.href;
|
|
75
|
+
}
|
|
76
|
+
function normalizeText(text) {
|
|
77
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
78
|
+
}
|
|
79
|
+
// ADR 18205 §2: an element produces a node when its role is not generic,
|
|
80
|
+
// none or presentation, or it has a name. With interestingOnly off every
|
|
81
|
+
// element does, and the container nodes stay in place.
|
|
82
|
+
function producesNode(role, name, context) {
|
|
83
|
+
return !context.interestingOnly || !(role === 'generic' || isPresentational(role)) || name !== '';
|
|
84
|
+
}
|
|
85
|
+
function isLeaf(element, role) {
|
|
86
|
+
return LEAF_ELEMENTS.has(element.localName) || CHILDREN_PRESENTATIONAL.has(role);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Appends the node(s) for one element to `out`: its own node with its
|
|
90
|
+
* children, or, when it produces no node (pruned role, visibility-hidden),
|
|
91
|
+
* its children in its place so hoisting keeps order.
|
|
92
|
+
*
|
|
93
|
+
* `textHidden` is true while inside an element whose visibility hides its
|
|
94
|
+
* text: visibility is inherited, so the text of such an element and of
|
|
95
|
+
* descendants that do not set themselves visible again is not rendered.
|
|
96
|
+
* `textConsumed` is true below a node whose name was computed from its
|
|
97
|
+
* content: that text already appears as the name and is not repeated as
|
|
98
|
+
* leaves, while the element structure below is still reported. `disabled`
|
|
99
|
+
* is true below an element that sets aria-disabled, which the states module
|
|
100
|
+
* applies to the descendants that can take focus.
|
|
101
|
+
*/
|
|
102
|
+
function visitElement(element, context, above, out) {
|
|
103
|
+
if (context.placed.has(element)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
context.placed.add(element);
|
|
107
|
+
const inherited = above.disabled || !setsAriaDisabled(element) ? above : Object.assign(Object.assign({}, above), { disabled: true });
|
|
108
|
+
const domParent = element.parentElement;
|
|
109
|
+
if (domParent && isCollapsedDetailsContent(element, domParent)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const hidden = hiddenState(element, context);
|
|
113
|
+
if (hidden === 'subtree') {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (hidden === 'self') {
|
|
117
|
+
collectChildren(element, context, Object.assign(Object.assign({}, inherited), { textHidden: true }), out);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const role = roleOf(element, context);
|
|
121
|
+
const name = computeName(element, context);
|
|
122
|
+
const descend = hidden !== 'contents' && !isLeaf(element, role);
|
|
123
|
+
if (!producesNode(role, name.text, context)) {
|
|
124
|
+
// The element is rendered, so its own visibility is visible even under
|
|
125
|
+
// an invisible ancestor: its text shows.
|
|
126
|
+
if (descend) {
|
|
127
|
+
collectChildren(element, context, Object.assign(Object.assign({}, inherited), { textHidden: false }), out);
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const node = elementNode(element, role, name.text, context, above.disabled);
|
|
132
|
+
if (descend) {
|
|
133
|
+
collectChildren(element, context, Object.assign(Object.assign({}, inherited), { textHidden: false, textConsumed: inherited.textConsumed || name.source === 'content' }), node.children);
|
|
134
|
+
}
|
|
135
|
+
out.push(node);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Appends the nodes for `parent`'s children to `out`: its flat-tree children
|
|
139
|
+
* in render order, then the elements it owns through aria-owns. An element
|
|
140
|
+
* some owner in the walked subtree claims is skipped at its DOM position and
|
|
141
|
+
* placed under that owner instead (ADR 18205 §3).
|
|
142
|
+
*/
|
|
143
|
+
function collectChildren(parent, context, inherited, out) {
|
|
144
|
+
// Text directly inside a closed details is collapsed content like any
|
|
145
|
+
// element other than its summary.
|
|
146
|
+
const textCollapsed = isClosedDetails(parent);
|
|
147
|
+
const children = flatTreeChildren(parent);
|
|
148
|
+
for (let i = 0; i < children.length; i++) {
|
|
149
|
+
const child = children[i];
|
|
150
|
+
if (child.nodeType === TEXT_NODE) {
|
|
151
|
+
if (!inherited.textHidden && !inherited.textConsumed && !textCollapsed) {
|
|
152
|
+
const text = normalizeText(child.nodeValue || '');
|
|
153
|
+
if (text !== '') {
|
|
154
|
+
out.push(textLeaf(text));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (child.nodeType === ELEMENT_NODE && !context.claimed.has(child)) {
|
|
160
|
+
visitElement(child, context, inherited, out);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const owned = context.owned.get(parent);
|
|
164
|
+
if (owned) {
|
|
165
|
+
for (const element of owned) {
|
|
166
|
+
// Hidden-ness still follows DOM ancestry: the walk never reaches the
|
|
167
|
+
// owned element's DOM ancestors on its way here, so they are checked
|
|
168
|
+
// now. So does aria-disabled, which an owned element does not share
|
|
169
|
+
// with its owner.
|
|
170
|
+
if (isHiddenByAncestor(element, context)) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
visitElement(element, context, Object.assign(Object.assign({}, inherited), { disabled: isDisabledByAncestor(element) }), out);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Whether placing `target` under `owner` would make the tree circular: the
|
|
178
|
+
// target is, or contains, the owner or one of the owner's accessibility
|
|
179
|
+
// ancestors, following the ownership recorded so far and DOM parentage
|
|
180
|
+
// otherwise.
|
|
181
|
+
function wouldCycle(target, owner, ownerOf) {
|
|
182
|
+
for (let current = owner; current; current = ownerOf.get(current) || current.parentElement) {
|
|
183
|
+
if (target.contains(current)) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
// The elements with aria-owns under `root`, in the flat tree the walk itself
|
|
190
|
+
// visits: an owner inside an open shadow root is found, and a light-DOM
|
|
191
|
+
// owner no slot takes is not, since it is never rendered and must not take
|
|
192
|
+
// a rendered element away from its place.
|
|
193
|
+
function collectOwners(element, out) {
|
|
194
|
+
if (element.hasAttribute('aria-owns')) {
|
|
195
|
+
out.push(element);
|
|
196
|
+
}
|
|
197
|
+
const children = flatTreeChildren(element);
|
|
198
|
+
for (let i = 0; i < children.length; i++) {
|
|
199
|
+
const child = children[i];
|
|
200
|
+
if (child.nodeType === ELEMENT_NODE) {
|
|
201
|
+
collectOwners(child, out);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Records every aria-owns relation whose owner is in the flat tree under
|
|
207
|
+
* `root`, so owned elements can be skipped where they sit and placed under
|
|
208
|
+
* their owner. An element is owned by the first owner in flat-tree order
|
|
209
|
+
* that can take it: a relation that would make the tree circular (owning
|
|
210
|
+
* yourself, an ancestor, or something that already owns you) is dropped, as
|
|
211
|
+
* is one whose owner has presentational children and so no children to own,
|
|
212
|
+
* and an id that resolves to nothing is ignored.
|
|
213
|
+
*/
|
|
214
|
+
function recordOwnership(root, context) {
|
|
215
|
+
const owners = [];
|
|
216
|
+
collectOwners(root, owners);
|
|
217
|
+
const ownerOf = new Map();
|
|
218
|
+
for (const owner of owners) {
|
|
219
|
+
if (isLeaf(owner, roleOf(owner, context))) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const scope = owner.getRootNode();
|
|
223
|
+
const targets = [];
|
|
224
|
+
for (const id of (owner.getAttribute('aria-owns') || '').trim().split(/\s+/)) {
|
|
225
|
+
const target = id ? scope.getElementById(id) : null;
|
|
226
|
+
if (target && !context.claimed.has(target) && !wouldCycle(target, owner, ownerOf)) {
|
|
227
|
+
targets.push(target);
|
|
228
|
+
context.claimed.add(target);
|
|
229
|
+
ownerOf.set(target, owner);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (targets.length) {
|
|
233
|
+
context.owned.set(owner, targets);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The snapshot rooted at `root`. The root always produces a node, whatever
|
|
239
|
+
* its role or hidden state, so a subtree snapshot of a plain div is still
|
|
240
|
+
* deterministic; a root whose subtree is hidden, by itself or by an
|
|
241
|
+
* ancestor, has no children.
|
|
242
|
+
*/
|
|
243
|
+
export function buildTree(root, context) {
|
|
244
|
+
recordOwnership(root, context);
|
|
245
|
+
context.placed.add(root);
|
|
246
|
+
const role = roleOf(root, context);
|
|
247
|
+
const name = computeName(root, context);
|
|
248
|
+
const disabledByAncestor = isDisabledByAncestor(root);
|
|
249
|
+
const node = elementNode(root, role, name.text, context, disabledByAncestor);
|
|
250
|
+
const hidden = hiddenState(root, context);
|
|
251
|
+
const descend = hidden !== 'subtree' && hidden !== 'contents' && !isLeaf(root, role) && !isHiddenByAncestor(root, context);
|
|
252
|
+
if (descend) {
|
|
253
|
+
collectChildren(root, context, {
|
|
254
|
+
textHidden: hidden === 'self',
|
|
255
|
+
textConsumed: name.source === 'content',
|
|
256
|
+
disabled: disabledByAncestor || setsAriaDisabled(root),
|
|
257
|
+
}, node.children);
|
|
258
|
+
}
|
|
259
|
+
return node;
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/tree.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;AAErB,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAmB,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC3H,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGjG,MAAM,YAAY,GAAG,CAAC,CAAA;AAC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AAE,CAAC;QACZ,eAAe,CACb,IAAI,EACJ,OAAO,EACP;YACE,UAAU,EAAE,MAAM,KAAK,MAAM;YAC7B,YAAY,EAAE,IAAI,CAAC,MAAM,KAAK,SAAS;YACvC,QAAQ,EAAE,kBAAkB,IAAI,gBAAgB,CAAC,IAAI,CAAC;SACvD,EACD,IAAI,CAAC,QAAQ,CACd,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type StateValue = boolean | number | 'mixed';
|
|
2
|
+
/** What a snapshot leaves out; every option has a default, so `{}` is the default snapshot. */
|
|
3
|
+
export interface SnapshotOptions {
|
|
4
|
+
/**
|
|
5
|
+
* With the default `true`, elements of role generic, none or presentation with
|
|
6
|
+
* no name produce no node and their children take their place (ADR 18205 §2).
|
|
7
|
+
* With `false` every rendered element produces a node, as Puppeteer's
|
|
8
|
+
* `accessibility.snapshot({ interestingOnly: false })` does.
|
|
9
|
+
*/
|
|
10
|
+
interestingOnly?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AccessibilityNode {
|
|
13
|
+
/** WAI-ARIA role token; "text" for text leaves, "iframe" for frame leaves. */
|
|
14
|
+
role: string;
|
|
15
|
+
/** Computed accessible name; "" when there is none. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Computed accessible description; "" when there is none. */
|
|
18
|
+
description: string;
|
|
19
|
+
/** Current value, present only for textbox, combobox, searchbox and range roles. */
|
|
20
|
+
value?: string;
|
|
21
|
+
/** The resolved href of a link, present only on role link whose element has one. */
|
|
22
|
+
url?: string;
|
|
23
|
+
/** States the role supports or the element sets; {} when there are none. */
|
|
24
|
+
states: Record<string, StateValue>;
|
|
25
|
+
/** The backing element; absent for text leaves and synthesized nodes. */
|
|
26
|
+
element?: Element;
|
|
27
|
+
/** [] for leaves. */
|
|
28
|
+
children: AccessibilityNode[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/types.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;AAEnD,+FAA+F;AAC/F,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAA;IACZ,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAA;IACZ,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAClC,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qBAAqB;IACrB,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAC9B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isEmbeddedControl(role: string): boolean;
|
|
2
|
+
/** The current value of an embedded control, or null when the role has none. */
|
|
3
|
+
export declare function embeddedValue(element: Element, role: string): string | null;
|
|
4
|
+
//# sourceMappingURL=value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/value.ts"],"names":[],"mappings":"AAyBA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AA8BD,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8B3E"}
|