vanilla-aria-modals 1.1.0 → 1.1.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/CHANGELOG.md +4 -2
- package/README.md +16 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file. Dates use I
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
6
|
|
|
7
|
-
## [1.1.
|
|
7
|
+
## [1.1.1] - 2026-02-15
|
|
8
|
+
### Fixed
|
|
9
|
+
- Fix typos, update changelog, and add an example wrapper usage for the `closeHandler`.
|
|
8
10
|
|
|
11
|
+
## [1.1.0] - 2026-02-15
|
|
9
12
|
### Added
|
|
10
13
|
- Support automatic modal key generation
|
|
11
14
|
- Add a manual method to rebind the trap focus handler
|
|
@@ -18,7 +21,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
18
21
|
### Fixed
|
|
19
22
|
- Prevent overlayless modals from breaking the stacking order
|
|
20
23
|
|
|
21
|
-
|
|
22
24
|
## [1.0.3] - 2026-01-23
|
|
23
25
|
### Fixed
|
|
24
26
|
- Improved `README.md` format for usage section
|
package/README.md
CHANGED
|
@@ -130,6 +130,21 @@ Registers ARIA events and modal stacking handling:
|
|
|
130
130
|
- **`closeLms?: HTMLElement[] | null;`** *(optional)* Array of elements that should trigger closing the modal (e.g., close buttons).
|
|
131
131
|
- **`exemptLms?: HTMLElement[];`** *(optional)* Array of elements that should not trigger closing even if clicked outside.
|
|
132
132
|
- **`closeHandler: (e: Event, modalKey: string) => void;`** Function to call when the modal should close. Usually should call **removeA11yEvents()**. Automatically receives the event **(e)** and **(modalKey)** from the wrapper; no need to pass as arguments. It’s up to the caller whether to use them.
|
|
133
|
+
If you need to pass additional arguments to the close handler, you can wrap it in a function that returns a handler accepting only the two parameters (`e` and `modalKey`):
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
const closeModalWrapper = (...args) => {
|
|
137
|
+
// Returns a handler that the utility calls internally with e and modalKey
|
|
138
|
+
return (e, modalKey) => {
|
|
139
|
+
// Your logic for the close handler here
|
|
140
|
+
// Access to parameters thanks to closures
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
modalHandler.addA11yEvents({
|
|
145
|
+
closeHandler: closeModalWrapper(...args)
|
|
146
|
+
});
|
|
147
|
+
```
|
|
133
148
|
|
|
134
149
|
Returns `void`
|
|
135
150
|
|
|
@@ -208,6 +223,6 @@ Returns `void`
|
|
|
208
223
|
|
|
209
224
|
Re-attaches the focus-trapping event listener for a specific modal. The internal **trapFocus** method already queries the DOM on each keyboard event, so in most cases, manually rebinding is not necessary.
|
|
210
225
|
|
|
211
|
-
- **`modalKey: string
|
|
226
|
+
- **`modalKey: string;`** The unique key of the modal whose focus trap should be rebound.
|
|
212
227
|
|
|
213
228
|
returns `void`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vanilla-aria-modals",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Framework-agnostic utility for managing accessibility in modals or modal-like UIs, including modal stacking, focus management, and closing via Escape key or outside click.",
|
|
5
5
|
"main": "src/ModalHandler.js",
|
|
6
6
|
"scripts": {
|