vanilla-aria-modals 1.1.1 → 1.1.2
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 -0
- package/README.md +17 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ 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.2] - 2026-02-15
|
|
8
|
+
### Fixed
|
|
9
|
+
- Unify `README.md` formatting for all bullet points. Previously, in some Markdown views, the bullet points format from the `addA11yEvents` method was broken due to a code block. This has been corrected so everything now displays consistently.
|
|
10
|
+
|
|
7
11
|
## [1.1.1] - 2026-02-15
|
|
8
12
|
### Fixed
|
|
9
13
|
- Fix typos, update changelog, and add an example wrapper usage for the `closeHandler`.
|
package/README.md
CHANGED
|
@@ -124,27 +124,28 @@ Registers ARIA events and modal stacking handling:
|
|
|
124
124
|
#### Parameters
|
|
125
125
|
**Takes parameters as a single object, which are destructured inside the method.**
|
|
126
126
|
|
|
127
|
-
- **`modalKey: string;`** Unique modal identifier. Used for stacking and event management.
|
|
127
|
+
- **`modalKey: string;`** Unique modal identifier. Used for stacking and event management.
|
|
128
128
|
- **`modalLm?: HTMLElement | null;`** *(optional)* The main modal element. Used to trap focus inside the modal.
|
|
129
|
-
- **`modalLmOuterLimits?: HTMLElement | null;`** *(optional)* The container that defines the modal boundary. Used to detect clicks outside the modal. **modalLm** is usually used here, but depending on the UI we may not want to trap focus into the same container we want to close, maybe just in a part of it.
|
|
130
|
-
- **`closeLms?: HTMLElement[] | null;`** *(optional)* Array of elements that should trigger closing the modal (e.g., close buttons).
|
|
131
|
-
- **`exemptLms?: HTMLElement[];`** *(optional)* Array of elements that should not trigger closing even if clicked outside.
|
|
132
|
-
- **`closeHandler: (e: Event, modalKey: string) => void;`** Function to call
|
|
129
|
+
- **`modalLmOuterLimits?: HTMLElement | null;`** *(optional)* The container that defines the modal boundary. Used to detect clicks outside the modal. **modalLm** is usually used here, but depending on the UI we may not want to trap focus into the same container we want to close, maybe just in a part of it.
|
|
130
|
+
- **`closeLms?: HTMLElement[] | null;`** *(optional)* Array of elements that should trigger closing the modal (e.g., close buttons).
|
|
131
|
+
- **`exemptLms?: HTMLElement[];`** *(optional)* Array of elements that should not trigger closing even if clicked outside.
|
|
132
|
+
- **`closeHandler: (e: Event, modalKey: string) => void;`** Function to call at modal 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
|
+
|
|
133
134
|
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
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
136
|
+
```js
|
|
137
|
+
const closeModalWrapper = (...args) => {
|
|
138
|
+
// Returns a handler that the utility calls internally with e and modalKey
|
|
139
|
+
return (e, modalKey) => {
|
|
140
|
+
// Your logic for the close handler here
|
|
141
|
+
// Access to parameters thanks to closures
|
|
142
142
|
}
|
|
143
|
+
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
modalHandler.addA11yEvents({
|
|
146
|
+
closeHandler: closeModalWrapper(...args)
|
|
147
|
+
});
|
|
148
|
+
```
|
|
148
149
|
|
|
149
150
|
Returns `void`
|
|
150
151
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vanilla-aria-modals",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
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": {
|