@cocreate/aria 1.8.0 → 2.0.1
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/.github/FUNDING.yml +1 -1
- package/.github/workflows/automated.yml +18 -7
- package/CHANGELOG.md +53 -20
- package/CONTRIBUTING.md +7 -7
- package/README.md +17 -17
- package/demo/index.html +1 -1
- package/docs/index.html +7 -7
- package/package.json +8 -8
- package/src/index.js +233 -3
package/.github/FUNDING.yml
CHANGED
|
@@ -12,16 +12,27 @@ jobs:
|
|
|
12
12
|
- name: Checkout repository
|
|
13
13
|
uses: actions/checkout@v7
|
|
14
14
|
|
|
15
|
-
- name: Sync package.json description to GitHub
|
|
15
|
+
- name: Sync package.json description and keywords to GitHub repository
|
|
16
16
|
env:
|
|
17
|
-
|
|
17
|
+
GH_TOKEN: ${{ secrets.GITHUB }}
|
|
18
18
|
run: |
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
if [ ! -f package.json ]; then
|
|
20
|
+
echo "No package.json found; skipping repository metadata sync."
|
|
21
|
+
exit 0
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
DESCRIPTION=$(jq -r '.description // empty' package.json)
|
|
25
|
+
if [ -n "$DESCRIPTION" ]; then
|
|
26
|
+
gh api --method PATCH "repos/${GITHUB_REPOSITORY}" -f description="$DESCRIPTION"
|
|
27
|
+
else
|
|
28
|
+
echo "No package description found; leaving GitHub description unchanged."
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if jq -e '.keywords | type == "array"' package.json >/dev/null; then
|
|
32
|
+
TOPICS=$(jq -c '.keywords | map(ascii_downcase | gsub("[^a-z0-9-]+"; "-") | gsub("(^-+|-+$)"; "") | .[0:50]) | map(select(length > 0)) | unique | .[0:20]' package.json)
|
|
33
|
+
printf '{"names":%s}' "$TOPICS" | gh api --method PUT -H "Accept: application/vnd.github+json" "repos/${GITHUB_REPOSITORY}/topics" --input -
|
|
23
34
|
else
|
|
24
|
-
echo "No
|
|
35
|
+
echo "No package keywords found; leaving GitHub topics unchanged."
|
|
25
36
|
fi
|
|
26
37
|
|
|
27
38
|
release:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,64 +1,97 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [2.0.1](https://github.com/CoCreateJS/aria/compare/v2.0.0...v2.0.1) (2026-11-05)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* upgrade CoCreate dependencies to v2 ([e1a6a3b](https://github.com/CoCreateJS/aria/commit/e1a6a3b588eaad9757904f37c560d96c0a0edecd))
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# [2.0.0](https://github.com/CoCreateJS/aria/compare/v1.3.2...v2.0.0) (2026-11-02)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
### Bug Fixes
|
|
12
12
|
|
|
13
|
-
*
|
|
13
|
+
* add Deno specific entries to .gitignore ([e4ecba9](https://github.com/CoCreateJS/aria/commit/e4ecba9483cdb38446b691a41e3f48751a3d76a9))
|
|
14
|
+
* avoid closing unconfigured popup triggers ([bc08a16](https://github.com/CoCreateJS/aria/commit/bc08a169bd2e4b6cb37725a72bc7f96a9feaea58))
|
|
15
|
+
* bump [@cocreate](https://github.com/cocreate) dependencies ([1a13ab0](https://github.com/CoCreateJS/aria/commit/1a13ab0b08b55fc4876f95fd6ea6609915f7d022))
|
|
16
|
+
* bump versions ([c2463fa](https://github.com/CoCreateJS/aria/commit/c2463faa4f8d885ef4101e50436ba68d7d13d204))
|
|
17
|
+
* bump versions ([816a7b0](https://github.com/CoCreateJS/aria/commit/816a7b0d5a05db62fc64053a47d053602f15eac6))
|
|
18
|
+
* enhance ARIA control initialization and selection handling ([1f89432](https://github.com/CoCreateJS/aria/commit/1f89432fa0f85d06c129d1e34a27280dc8a93119))
|
|
19
|
+
* preserve native popup interactions ([8c2574b](https://github.com/CoCreateJS/aria/commit/8c2574bd1646f6e5e2ecfcab799f32204f38e8b2))
|
|
20
|
+
* remove trailing slash from node_modules entry in .gitignore ([0afb83e](https://github.com/CoCreateJS/aria/commit/0afb83e605bec7eaeeac4278b4ad18a19c747313))
|
|
21
|
+
* update git url ([b1a4ee6](https://github.com/CoCreateJS/aria/commit/b1a4ee6adbb3289a0add83f4d18a00675729f128))
|
|
22
|
+
* update GitHub Actions to use latest versions and sync package.json description ([ab3a85b](https://github.com/CoCreateJS/aria/commit/ab3a85b7d4a384f423ed6cd6cc21d2ac16867d64))
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* align CoCreate repository and package naming ([39a5de4](https://github.com/CoCreateJS/aria/commit/39a5de421c7a6bec3a9c90745ce21bea8718d594))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* consumers must use the renamed CoCreate package and repository identities; the previous prefixed names are no longer supported.
|
|
33
|
+
|
|
34
|
+
## [1.3.2](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.3.1...v1.3.2) (2026-07-19)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* set default branch to main ([36e8f2e](https://github.com/CoCreateJS/CoCreate-aria/commit/36e8f2eaa4fd0a7e4e871737f93a964aaea0f373))
|
|
40
|
+
|
|
41
|
+
## [1.3.1](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.3.0...v1.3.1) (2026-07-17)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* bump dependencies ([81718d0](https://github.com/CoCreateJS/CoCreate-aria/commit/81718d04eb9806d2d841f0728af775465595c2e6))
|
|
47
|
+
|
|
48
|
+
# [1.3.0](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.2.1...v1.3.0) (2026-07-17)
|
|
16
49
|
|
|
17
50
|
|
|
18
51
|
### Features
|
|
19
52
|
|
|
20
|
-
* update automated workflow and release configuration for improved semantic release handling ([496feb1](https://github.com/
|
|
53
|
+
* update automated workflow and release configuration for improved semantic release handling ([496feb1](https://github.com/CoCreateJS/CoCreate-aria/commit/496feb179258d215ed33d644e0e412712bf9b2a7))
|
|
21
54
|
|
|
22
|
-
## [1.2.1](https://github.com/
|
|
55
|
+
## [1.2.1](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.2.0...v1.2.1) (2026-07-11)
|
|
23
56
|
|
|
24
57
|
|
|
25
58
|
### Bug Fixes
|
|
26
59
|
|
|
27
|
-
* bump package versions ([2ad08d0](https://github.com/
|
|
28
|
-
* removed post install and add add packages to apprved list ([100c02b](https://github.com/
|
|
29
|
-
* semantic version handling ([a64a089](https://github.com/
|
|
30
|
-
* update aria-open and aria-close attribute handling to treat them as boolean-like ([608bb59](https://github.com/
|
|
60
|
+
* bump package versions ([2ad08d0](https://github.com/CoCreateJS/CoCreate-aria/commit/2ad08d0434fd16624190902a3da18d3e1aabdee2))
|
|
61
|
+
* removed post install and add add packages to apprved list ([100c02b](https://github.com/CoCreateJS/CoCreate-aria/commit/100c02b93154001d03f2cb9ce6da41ea9c337df2))
|
|
62
|
+
* semantic version handling ([a64a089](https://github.com/CoCreateJS/CoCreate-aria/commit/a64a089292f5d7dd86d6439066081f8d701c8404))
|
|
63
|
+
* update aria-open and aria-close attribute handling to treat them as boolean-like ([608bb59](https://github.com/CoCreateJS/CoCreate-aria/commit/608bb59372d3fc0dabbcda96f8be4ef4e34d8405))
|
|
31
64
|
|
|
32
|
-
# [1.2.0](https://github.com/
|
|
65
|
+
# [1.2.0](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.1.1...v1.2.0) (2026-02-09)
|
|
33
66
|
|
|
34
67
|
|
|
35
68
|
### Bug Fixes
|
|
36
69
|
|
|
37
|
-
* root factory variable Module ([6f35875](https://github.com/
|
|
70
|
+
* root factory variable Module ([6f35875](https://github.com/CoCreateJS/CoCreate-aria/commit/6f358757c9917ec52c397a35bc6f5e97976de6ed))
|
|
38
71
|
|
|
39
72
|
|
|
40
73
|
### Features
|
|
41
74
|
|
|
42
|
-
* aria-attribute-group for tab navigation grouping to deactivate state of other tabs in the group ([12822c0](https://github.com/
|
|
75
|
+
* aria-attribute-group for tab navigation grouping to deactivate state of other tabs in the group ([12822c0](https://github.com/CoCreateJS/CoCreate-aria/commit/12822c04fbe41672833852018242a58c179b9229))
|
|
43
76
|
|
|
44
|
-
## [1.1.1](https://github.com/
|
|
77
|
+
## [1.1.1](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.1.0...v1.1.1) (2025-12-26)
|
|
45
78
|
|
|
46
79
|
|
|
47
80
|
### Bug Fixes
|
|
48
81
|
|
|
49
|
-
* update worklow ([32b1cff](https://github.com/
|
|
82
|
+
* update worklow ([32b1cff](https://github.com/CoCreateJS/CoCreate-aria/commit/32b1cffdce4f66ab078407cae412a5583afb92a4))
|
|
50
83
|
|
|
51
|
-
# [1.1.0](https://github.com/
|
|
84
|
+
# [1.1.0](https://github.com/CoCreateJS/CoCreate-aria/compare/v1.0.0...v1.1.0) (2025-11-16)
|
|
52
85
|
|
|
53
86
|
|
|
54
87
|
### Features
|
|
55
88
|
|
|
56
|
-
* Enhance popup close conditions and aria attributes handling ([608da59](https://github.com/
|
|
57
|
-
* Initialize aria controls and enhance event handling ([a62f790](https://github.com/
|
|
89
|
+
* Enhance popup close conditions and aria attributes handling ([608da59](https://github.com/CoCreateJS/CoCreate-aria/commit/608da59ac5f179a2c9ddf27d2657c2f28d355766))
|
|
90
|
+
* Initialize aria controls and enhance event handling ([a62f790](https://github.com/CoCreateJS/CoCreate-aria/commit/a62f79079a0c889b8d395406df2ef4a704ac6552))
|
|
58
91
|
|
|
59
92
|
# 1.0.0 (2025-08-25)
|
|
60
93
|
|
|
61
94
|
|
|
62
95
|
### Features
|
|
63
96
|
|
|
64
|
-
* Initial Release ([ea0d83d](https://github.com/
|
|
97
|
+
* Initial Release ([ea0d83d](https://github.com/CoCreateJS/CoCreate-aria/commit/ea0d83d31949a2cd9d66a7dd784f6622f32258ef))
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Contributing to CoCreate-aria
|
|
2
2
|
|
|
3
|
-
This project is work of [many contributors](https://github.com/
|
|
4
|
-
You're encouraged to submit [pull requests](https://github.com/
|
|
5
|
-
[propose features and discuss issues](https://github.com/
|
|
3
|
+
This project is work of [many contributors](https://github.com/CoCreateJS/aria/graphs/contributors).
|
|
4
|
+
You're encouraged to submit [pull requests](https://github.com/CoCreateJS/aria/pulls),
|
|
5
|
+
[propose features and discuss issues](https://github.com/CoCreateJS/aria/issues).
|
|
6
6
|
|
|
7
7
|
In the examples below, substitute your Github username for `contributor` in URLs.
|
|
8
8
|
|
|
9
9
|
## Fork the Project
|
|
10
10
|
|
|
11
|
-
Fork the [project on Github](https://github.com/
|
|
11
|
+
Fork the [project on Github](https://github.com/CoCreateJS/aria) and check out your copy.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
git clone https://github.com/contributor/CoCreate-aria.git
|
|
15
15
|
cd CoCreate-aria
|
|
16
|
-
git remote add upstream https://
|
|
16
|
+
git remote add upstream https://github.com/CoCreateJS/aria.git
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Create a Topic Branch
|
|
@@ -70,7 +70,7 @@ git push origin my-feature-branch
|
|
|
70
70
|
|
|
71
71
|
## Make a Pull Request
|
|
72
72
|
|
|
73
|
-
Go to [https://github.com/
|
|
73
|
+
Go to [https://github.com/CoCreateJS/aria](https://github.com/CoCreateJS/aria) and select your feature branch.
|
|
74
74
|
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
|
75
75
|
|
|
76
76
|
## Rebase
|
|
@@ -88,7 +88,7 @@ git push origin my-feature-branch -f
|
|
|
88
88
|
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
|
89
89
|
|
|
90
90
|
```
|
|
91
|
-
* [#123](https://github.com/
|
|
91
|
+
* [#123](https://github.com/CoCreateJS/industry/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
Amend your previous commit and force push the changes.
|
package/README.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
# CoCreate-aria
|
|
2
2
|
|
|
3
|
-
Orchestrate dynamic UI behavior and ARIA state with event-driven action chains, configured via HTML5 attributes or the JavaScript API. Take it for a spin in our [playground!](https://
|
|
3
|
+
Orchestrate dynamic UI behavior and ARIA state with event-driven action chains, configured via HTML5 attributes or the JavaScript API. Take it for a spin in our [playground!](https://CoCreateJS.com/docs/aria)
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
10
|

|
|
11
11
|
|
|
12
|
-

|
|
13
13
|
|
|
14
|
-
## [Docs & Demo](https://
|
|
14
|
+
## [Docs & Demo](https://CoCreateJS.com/docs/aria)
|
|
15
15
|
|
|
16
|
-
For a complete guide and working demo refer to the [doumentation](https://
|
|
16
|
+
For a complete guide and working demo refer to the [doumentation](https://CoCreateJS.com/docs/aria)
|
|
17
17
|
|
|
18
18
|
## CDN
|
|
19
19
|
|
|
20
20
|
```html
|
|
21
|
-
<script src="https://cdn.
|
|
21
|
+
<script src="https://cdn.CoCreateJS.com/aria/latest/CoCreate-aria.min.js"></script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
```html
|
|
25
|
-
<script src="https://cdn.
|
|
25
|
+
<script src="https://cdn.CoCreateJS.com/aria/latest/CoCreate-aria.min.css"></script>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## NPM
|
|
@@ -50,13 +50,13 @@ $ yarn install @cocreate/aria
|
|
|
50
50
|
|
|
51
51
|
# Announcements
|
|
52
52
|
|
|
53
|
-
All updates to this library are documented in our [CHANGELOG](https://github.com/
|
|
53
|
+
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreateJS/aria/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreateJS/aria/releases). You may also subscribe to email for releases and breaking changes.
|
|
54
54
|
|
|
55
55
|
<a name="roadmap"></a>
|
|
56
56
|
|
|
57
57
|
# Roadmap
|
|
58
58
|
|
|
59
|
-
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/
|
|
59
|
+
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreateJS/aria/issues) and [pull requests](https://github.com/CoCreateJS/aria/pulls). We would love to hear your feedback.
|
|
60
60
|
|
|
61
61
|
<a name="about"></a>
|
|
62
62
|
|
|
@@ -64,7 +64,7 @@ If you are interested in the future direction of this project, please take a loo
|
|
|
64
64
|
|
|
65
65
|
CoCreate-aria is guided and supported by the CoCreate Developer Experience Team.
|
|
66
66
|
|
|
67
|
-
Please Email the Developer Experience Team [here](mailto:develop@
|
|
67
|
+
Please Email the Developer Experience Team [here](mailto:develop@CoCreateJS.com) in case of any queries.
|
|
68
68
|
|
|
69
69
|
CoCreate-aria is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
|
|
70
70
|
|
|
@@ -72,9 +72,9 @@ CoCreate-aria is maintained and funded by CoCreate. The names and logos for CoCr
|
|
|
72
72
|
|
|
73
73
|
# How to Contribute
|
|
74
74
|
|
|
75
|
-
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/
|
|
75
|
+
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreateJS/aria/blob/master/CONTRIBUTING.md) guide for details.
|
|
76
76
|
|
|
77
|
-
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/
|
|
77
|
+
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/CoCreateJS/aria/issues) and [pull requests](https://github.com/CoCreateJS/aria/pulls) or merely upvote or comment on existing issues or pull requests.
|
|
78
78
|
|
|
79
79
|
We appreciate your continued support, thank you!
|
|
80
80
|
|
|
@@ -82,7 +82,7 @@ We appreciate your continued support, thank you!
|
|
|
82
82
|
|
|
83
83
|
# License
|
|
84
84
|
|
|
85
|
-
[The MIT License (MIT)](https://github.com/
|
|
85
|
+
[The MIT License (MIT)](https://github.com/CoCreateJS/aria/blob/master/LICENSE)
|
|
86
86
|
|
|
87
87
|
## Toggle buttons and selection groups
|
|
88
88
|
|
package/demo/index.html
CHANGED
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
|
|
53
53
|
<!--<script src="../dist/CoCreate-aria.js" ></script>-->
|
|
54
54
|
<!-- <script src="../../../CoCreateJS/dist/CoCreate.js"></script> -->
|
|
55
|
-
<script src="https://
|
|
55
|
+
<script src="https://CoCreateJS.com/dist/CoCreate.js"></script>
|
|
56
56
|
</body>
|
|
57
57
|
</html>
|
package/docs/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
rel="icon"
|
|
10
10
|
type="image/png"
|
|
11
11
|
sizes="32x32"
|
|
12
|
-
href="https://
|
|
12
|
+
href="https://CoCreateJS.com/images/favicon.ico" />
|
|
13
13
|
<meta
|
|
14
14
|
name="description"
|
|
15
15
|
content="A convenient chain handler allows user to chain multiple components together. When one aria is complete next one will start untill all aria completed." />
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<meta name="robots" content="index,follow" />
|
|
20
20
|
<meta
|
|
21
21
|
property="og:image"
|
|
22
|
-
content="https://cdn.
|
|
22
|
+
content="https://cdn.CoCreateJS.com/docs/aria.png" />
|
|
23
23
|
|
|
24
24
|
<link
|
|
25
25
|
rel="stylesheet"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
share-title="CoCreate aria"
|
|
70
70
|
share-height="600"
|
|
71
71
|
share-width="700"
|
|
72
|
-
share-media="https://cdn.
|
|
72
|
+
share-media="https://cdn.CoCreateJS.com/docs/aria.png"
|
|
73
73
|
hover="display:block!important"
|
|
74
74
|
hover-query=".social-networks">
|
|
75
75
|
<div class="display:none social-networks">
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
></a>
|
|
108
108
|
</div>
|
|
109
109
|
<a
|
|
110
|
-
href="https://github.com/
|
|
110
|
+
href="https://github.com/CoCreateJS/CoCreate-aria"
|
|
111
111
|
target="_blank"
|
|
112
112
|
class=""
|
|
113
113
|
><i src="/assets/svg/github.svg"></i
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
<p class="padding:10px_0px line-height:1.5">
|
|
149
149
|
Or you can use cdn link:
|
|
150
150
|
</p>
|
|
151
|
-
<pre><code class="language-html"><script>https://cdn.
|
|
151
|
+
<pre><code class="language-html"><script>https://cdn.CoCreateJS.com/aria/latest/CoCreate-aria.min.js</script></code></pre>
|
|
152
152
|
|
|
153
153
|
<div
|
|
154
154
|
id="aria-usage"
|
|
@@ -336,12 +336,12 @@
|
|
|
336
336
|
</div>
|
|
337
337
|
</div>
|
|
338
338
|
<button
|
|
339
|
-
href="https://github.com/
|
|
339
|
+
href="https://github.com/CoCreateJS/CoCreate-aria/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
340
340
|
target="_blank"
|
|
341
341
|
class="display:flex justify-content:center align-items:center position:fixed bottom:15px right:15px height:50px width:50px border-radius:50% box-shadow:0px_2px_10px_0px_rgba(0,_0,_0,_0.4)">
|
|
342
342
|
<i src="../assets/svg/pencil-alt.svg"></i>
|
|
343
343
|
</button>
|
|
344
344
|
</main>
|
|
345
|
-
<script src="https://
|
|
345
|
+
<script src="https://CoCreateJS.com/dist/CoCreate.js"></script>
|
|
346
346
|
</body>
|
|
347
347
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/aria",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Orchestrate dynamic UI behavior and ARIA state with event-driven action chains, configured via HTML5 attributes or the JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aria",
|
|
@@ -25,25 +25,25 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://
|
|
28
|
+
"url": "git+https://github.com/CoCreateJS/aria.git"
|
|
29
29
|
},
|
|
30
30
|
"author": "CoCreate LLC",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"bugs": {
|
|
33
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/CoCreateJS/aria/issues"
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://CoCreateJS.com/docs/aria",
|
|
36
36
|
"funding": {
|
|
37
37
|
"type": "GitHub Sponsors ❤",
|
|
38
|
-
"url": "https://github.com/sponsors/
|
|
38
|
+
"url": "https://github.com/sponsors/CoCreateJS"
|
|
39
39
|
},
|
|
40
40
|
"main": "./src/index.js",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@cocreate/observer": "^
|
|
43
|
-
"@cocreate/state": "^
|
|
42
|
+
"@cocreate/observer": "^2.0.0",
|
|
43
|
+
"@cocreate/state": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@cocreate/webpack": "^
|
|
46
|
+
"@cocreate/webpack": "^2.0.0"
|
|
47
47
|
},
|
|
48
48
|
"allowScripts": {
|
|
49
49
|
"@cocreate/observer@1.19.0": true,
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,8 @@ import State from '@cocreate/state';
|
|
|
6
6
|
* Orchestrates the setup of interactive controls and navigation states.
|
|
7
7
|
* @param {Element|Element[]|NodeList} [elements] - Optional specific elements to initialize.
|
|
8
8
|
* If omitted, the script scans the document for controls, toggles, and custom checked controls.
|
|
9
|
+
* @public
|
|
10
|
+
* @environment client
|
|
9
11
|
*/
|
|
10
12
|
function init(elements) {
|
|
11
13
|
// 1. Initialize aria-controls (Toggles, Popups, Tabs)
|
|
@@ -34,6 +36,11 @@ const interactiveSelector = '[aria-controls], [aria-pressed], [role="radio"], [r
|
|
|
34
36
|
const addedInteractiveSelector = '[aria-controls], [aria-pressed], [role="radio"], [role="checkbox"], [role="switch"], [aria-selected], input[type="checkbox"]';
|
|
35
37
|
const initialized = new WeakSet();
|
|
36
38
|
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @environment client
|
|
43
|
+
*/
|
|
37
44
|
function initElement(elements) {
|
|
38
45
|
if (
|
|
39
46
|
!Array.isArray(elements) &&
|
|
@@ -143,6 +150,8 @@ function initElement(elements) {
|
|
|
143
150
|
* Synchronizes aria-expanded state across all elements controlling the same ID.
|
|
144
151
|
* @param {string} controlledId - The ID of the target element.
|
|
145
152
|
* @param {string} state - The target state ('true' or 'false').
|
|
153
|
+
* @private
|
|
154
|
+
* @environment client
|
|
146
155
|
*/
|
|
147
156
|
function updateAllControls(controlledId, state) {
|
|
148
157
|
const allControls = getControls(controlledId);
|
|
@@ -157,6 +166,8 @@ function updateAllControls(controlledId, state) {
|
|
|
157
166
|
/**
|
|
158
167
|
* Returns every controller referencing an ID. In addition to the common
|
|
159
168
|
* single-ID form, tolerate whitespace- or comma-separated references.
|
|
169
|
+
* @public
|
|
170
|
+
* @environment client
|
|
160
171
|
*/
|
|
161
172
|
function getControls(controlledId) {
|
|
162
173
|
return Array.from(document.querySelectorAll("[aria-controls]")).filter(control =>
|
|
@@ -170,6 +181,8 @@ function getControls(controlledId) {
|
|
|
170
181
|
/**
|
|
171
182
|
* Writes an attribute only when its normalized string value changes.
|
|
172
183
|
* This keeps controller/controlled-element mutation synchronization finite.
|
|
184
|
+
* @private
|
|
185
|
+
* @environment client
|
|
173
186
|
*/
|
|
174
187
|
function setAttributeIfChanged(element, attribute, value) {
|
|
175
188
|
const nextValue = String(value);
|
|
@@ -520,6 +533,8 @@ function handleSelectionKey(event) {
|
|
|
520
533
|
/**
|
|
521
534
|
* Applies a controller's aria-expanded value to its controlled element and
|
|
522
535
|
* synchronizes any other controllers that reference the same element.
|
|
536
|
+
* @public
|
|
537
|
+
* @environment client
|
|
523
538
|
*/
|
|
524
539
|
function syncController(control) {
|
|
525
540
|
const controlledId = control?.getAttribute?.("aria-controls");
|
|
@@ -565,6 +580,8 @@ function syncController(control) {
|
|
|
565
580
|
/**
|
|
566
581
|
* Treats aria-hidden on the controlled element as canonical and uses the first
|
|
567
582
|
* controller to fan that state out to every controller for the same ID.
|
|
583
|
+
* @public
|
|
584
|
+
* @environment client
|
|
568
585
|
*/
|
|
569
586
|
function syncControlledElement(controlledElement) {
|
|
570
587
|
const controlledId = controlledElement?.id;
|
|
@@ -592,6 +609,8 @@ function syncControlledElement(controlledElement) {
|
|
|
592
609
|
* Initializes a newly added controller from its controlled element when that
|
|
593
610
|
* element already has aria-hidden state. Initialization never writes state
|
|
594
611
|
* from a controller to a controlled element.
|
|
612
|
+
* @public
|
|
613
|
+
* @environment client
|
|
595
614
|
*/
|
|
596
615
|
function syncAddedController(control) {
|
|
597
616
|
const controlledId = control?.getAttribute?.("aria-controls");
|
|
@@ -611,6 +630,11 @@ function syncAddedController(control) {
|
|
|
611
630
|
*/
|
|
612
631
|
const pendingStateElements = new Set();
|
|
613
632
|
let stateTimer;
|
|
633
|
+
/**
|
|
634
|
+
*
|
|
635
|
+
* @public
|
|
636
|
+
* @environment client
|
|
637
|
+
*/
|
|
614
638
|
function syncControlledElementState(controlledElement) {
|
|
615
639
|
if (!controlledElement?.hasAttribute?.("state.aria-hidden") ||
|
|
616
640
|
!controlledElement.hasAttribute("state-id")) return;
|
|
@@ -643,7 +667,7 @@ function syncControlledElementState(controlledElement) {
|
|
|
643
667
|
for (const [storage, state] of Object.entries(groups)) {
|
|
644
668
|
if (!Object.keys(state).length) continue;
|
|
645
669
|
let snapshot = {};
|
|
646
|
-
try { snapshot = JSON.parse(window.history.state?.[`${storage}State`] || '{}'); } catch {}
|
|
670
|
+
try { snapshot = JSON.parse(window.history.state?.[`${storage}State`] || '{}'); } catch { }
|
|
647
671
|
// State restoration already owns this history entry. Do not push
|
|
648
672
|
// it again when ARIA observes the restored attributes.
|
|
649
673
|
if (Object.entries(state).every(([id, value]) => snapshot?.[id]?.["aria-hidden"] === value["aria-hidden"])) continue;
|
|
@@ -661,7 +685,7 @@ let popupListener = null;
|
|
|
661
685
|
function getOpenPopupControls() {
|
|
662
686
|
return Array.from(document.querySelectorAll('[aria-controls][aria-expanded="true"]')).filter(control =>
|
|
663
687
|
!isSelectionControl(control) && (control.hasAttribute("aria-haspopup") ||
|
|
664
|
-
|
|
688
|
+
document.getElementById(control.getAttribute("aria-controls"))?.hasAttribute("aria-close-on"))
|
|
665
689
|
);
|
|
666
690
|
}
|
|
667
691
|
|
|
@@ -748,6 +772,8 @@ function addPopupListener() {
|
|
|
748
772
|
|
|
749
773
|
/**
|
|
750
774
|
* Removes the global popup click listener.
|
|
775
|
+
* @private
|
|
776
|
+
* @environment client
|
|
751
777
|
*/
|
|
752
778
|
function removePopupListener() {
|
|
753
779
|
if (popupListener) {
|
|
@@ -759,6 +785,8 @@ function removePopupListener() {
|
|
|
759
785
|
/**
|
|
760
786
|
* Binds the Escape key to close the controlled element.
|
|
761
787
|
* @param {Element} control - The trigger element that controls the target.
|
|
788
|
+
* @private
|
|
789
|
+
* @environment client
|
|
762
790
|
*/
|
|
763
791
|
function initEscapeKey(control) {
|
|
764
792
|
const controlledId = control.getAttribute("aria-controls");
|
|
@@ -772,6 +800,8 @@ function initEscapeKey(control) {
|
|
|
772
800
|
/**
|
|
773
801
|
* Global handler for the Escape key to close open interactive elements.
|
|
774
802
|
* @param {KeyboardEvent} event - The keyboard event object.
|
|
803
|
+
* @private
|
|
804
|
+
* @environment client
|
|
775
805
|
*/
|
|
776
806
|
function handleEscapeKey(event) {
|
|
777
807
|
if (event.key === "Escape") {
|
|
@@ -790,6 +820,8 @@ function handleEscapeKey(event) {
|
|
|
790
820
|
* the current URL and hash. Assigns aria-current="page" or "location".
|
|
791
821
|
* @param {Element|Element[]|NodeList} [elements] - Links or containers to scan.
|
|
792
822
|
* Defaults to all a[href] if not provided.
|
|
823
|
+
* @public
|
|
824
|
+
* @environment client
|
|
793
825
|
*/
|
|
794
826
|
function setAriaCurrent(elements) {
|
|
795
827
|
if (!elements) {
|
|
@@ -856,6 +888,8 @@ function setAriaCurrent(elements) {
|
|
|
856
888
|
* Sanitizes and normalizes URL paths to prevent trailing slash mismatches.
|
|
857
889
|
* @param {string} path - The raw URL path.
|
|
858
890
|
* @returns {string} The normalized path string.
|
|
891
|
+
* @private
|
|
892
|
+
* @environment client
|
|
859
893
|
*/
|
|
860
894
|
const normalizePath = (path) => path.replace(/\/$/, "") || "/";
|
|
861
895
|
|
|
@@ -967,7 +1001,7 @@ Observer.init({
|
|
|
967
1001
|
name: "aria-current",
|
|
968
1002
|
types: ["addedNodes", "attributes"],
|
|
969
1003
|
selector: "a[href]",
|
|
970
|
-
|
|
1004
|
+
attributeFilter: ["href"],
|
|
971
1005
|
callback: function (mutation) {
|
|
972
1006
|
setAriaCurrent(mutation.target);
|
|
973
1007
|
}
|
|
@@ -986,3 +1020,199 @@ export {
|
|
|
986
1020
|
syncControlledElementState,
|
|
987
1021
|
getControls
|
|
988
1022
|
};
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
*
|
|
1026
|
+
* @name aria-checked
|
|
1027
|
+
* @kind attribute
|
|
1028
|
+
* @environment client
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
*
|
|
1033
|
+
* @name aria-close
|
|
1034
|
+
* @kind attribute
|
|
1035
|
+
* @environment client
|
|
1036
|
+
*/
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
*
|
|
1040
|
+
* @name aria-close-on
|
|
1041
|
+
* @kind attribute
|
|
1042
|
+
* @environment client
|
|
1043
|
+
*/
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
*
|
|
1047
|
+
* @name aria-controls
|
|
1048
|
+
* @kind attribute
|
|
1049
|
+
* @environment client
|
|
1050
|
+
*/
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
*
|
|
1054
|
+
* @name aria-controls-class
|
|
1055
|
+
* @kind attribute
|
|
1056
|
+
* @environment client
|
|
1057
|
+
*/
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
*
|
|
1061
|
+
* @name aria-controls-group
|
|
1062
|
+
* @kind attribute
|
|
1063
|
+
* @environment client
|
|
1064
|
+
*/
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
*
|
|
1068
|
+
* @name aria-current
|
|
1069
|
+
* @kind attribute
|
|
1070
|
+
* @environment client
|
|
1071
|
+
*/
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
*
|
|
1075
|
+
* @name aria-default
|
|
1076
|
+
* @kind attribute
|
|
1077
|
+
* @environment client
|
|
1078
|
+
*/
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
*
|
|
1082
|
+
* @name aria-disabled
|
|
1083
|
+
* @kind attribute
|
|
1084
|
+
* @environment client
|
|
1085
|
+
*/
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
*
|
|
1089
|
+
* @name aria-expanded
|
|
1090
|
+
* @kind attribute
|
|
1091
|
+
* @environment client
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
*
|
|
1096
|
+
* @name aria-haspopup
|
|
1097
|
+
* @kind attribute
|
|
1098
|
+
* @environment client
|
|
1099
|
+
*/
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
*
|
|
1103
|
+
* @name aria-hidden
|
|
1104
|
+
* @kind attribute
|
|
1105
|
+
* @environment client
|
|
1106
|
+
*/
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
*
|
|
1110
|
+
* @name aria-open
|
|
1111
|
+
* @kind attribute
|
|
1112
|
+
* @environment client
|
|
1113
|
+
*/
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
*
|
|
1117
|
+
* @name aria-orientation
|
|
1118
|
+
* @kind attribute
|
|
1119
|
+
* @environment client
|
|
1120
|
+
*/
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
*
|
|
1124
|
+
* @name aria-pressed
|
|
1125
|
+
* @kind attribute
|
|
1126
|
+
* @environment client
|
|
1127
|
+
*/
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
*
|
|
1131
|
+
* @name aria-selected
|
|
1132
|
+
* @kind attribute
|
|
1133
|
+
* @environment client
|
|
1134
|
+
*/
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
*
|
|
1138
|
+
* @name disabled
|
|
1139
|
+
* @kind attribute
|
|
1140
|
+
* @environment client
|
|
1141
|
+
*/
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
*
|
|
1145
|
+
* @name hidden
|
|
1146
|
+
* @kind attribute
|
|
1147
|
+
* @environment client
|
|
1148
|
+
*/
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
*
|
|
1152
|
+
* @name href
|
|
1153
|
+
* @kind attribute
|
|
1154
|
+
* @environment client
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
*
|
|
1159
|
+
* @name role
|
|
1160
|
+
* @kind attribute
|
|
1161
|
+
* @environment client
|
|
1162
|
+
*/
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
*
|
|
1166
|
+
* @name state-id
|
|
1167
|
+
* @kind attribute
|
|
1168
|
+
* @environment client
|
|
1169
|
+
*/
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
*
|
|
1173
|
+
* @name state-localstorage
|
|
1174
|
+
* @kind attribute
|
|
1175
|
+
* @environment client
|
|
1176
|
+
*/
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
*
|
|
1180
|
+
* @name state-onstoragechange
|
|
1181
|
+
* @kind attribute
|
|
1182
|
+
* @environment client
|
|
1183
|
+
*/
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
*
|
|
1187
|
+
* @name tabindex
|
|
1188
|
+
* @kind attribute
|
|
1189
|
+
* @environment client
|
|
1190
|
+
*/
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Orchestrate dynamic UI behavior and ARIA state with event-driven action chains, configured via HTML5 attributes or the JavaScript API.
|
|
1194
|
+
*
|
|
1195
|
+
* @module aria
|
|
1196
|
+
* @environment client
|
|
1197
|
+
*/
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Declarative selectors recognized by this module.
|
|
1201
|
+
*
|
|
1202
|
+
* @name declarative-selectors
|
|
1203
|
+
* @kind member
|
|
1204
|
+
* @selectors
|
|
1205
|
+
* @environment client
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```json
|
|
1208
|
+
* [
|
|
1209
|
+
* ":is([role=\"row\"][aria-selected])",
|
|
1210
|
+
* "*",
|
|
1211
|
+
* "[aria-controls]",
|
|
1212
|
+
* "[aria-hidden]",
|
|
1213
|
+
* "a[href]",
|
|
1214
|
+
* "[aria-controls], [aria-pressed], [role=\"radio\"], [role=\"checkbox\"], [role=\"switch\"], :is([role=\"row\"][aria-selected]), :is([role=\"grid\"][aria-multiselectable=\"true\"] [role=\"row\"] input[type=\"checkbox\"])",
|
|
1215
|
+
* "[aria-controls], [aria-pressed], [role=\"radio\"], [role=\"checkbox\"], [role=\"switch\"], [aria-selected], input[type=\"checkbox\"]"
|
|
1216
|
+
* ]
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|