Skip to content

Commit 7adf8e2

Browse files
committed
Release v2.2.1
1 parent d92e8a2 commit 7adf8e2

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99
[Unreleased]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.1...HEAD
1010

11+
## [2.2.1] - 2025-10-09
12+
[2.2.1]: https://github.com/fylgja/alpinejs-dialog/compare/v2.2.0...v2.2.1
13+
14+
### Fixed
15+
16+
- Missing closeby logic for escape key
17+
- Missing submit logic from not triggering the close event
18+
1119
## [2.2.0] - 2025-10-09
1220
[2.2.0]: https://github.com/fylgja/alpinejs-dialog/compare/v2.1.1...v2.2.0
1321

dist/index.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function dialog_default(Alpine) {
3131
};
3232
const canEvaluate = expression.length > 0;
3333
const lockPageScroll = modifiers.includes("noscroll");
34-
const closeBy = el.hasAttribute("closeby") ? el.getAttribute("closeby") : modifierValue(modifiers, "closeby", "closerequest");
34+
const closeBy = el.getAttribute("closeby") || modifierValue(modifiers, "closeby", "closerequest");
3535
el.style.display = null;
3636
el.style.length === 0 && el.removeAttribute("style");
3737
if (el._x_isShown) {
@@ -45,12 +45,14 @@ function dialog_default(Alpine) {
4545
}
4646
function dialogSubmit(event) {
4747
var _a;
48-
if ((event.target.getAttribute("method") === "dialog" || ((_a = event.submitter) == null ? void 0 : _a.getAttribute("formmethod")) === "dialog") && !canEvaluate) {
48+
if (event.target.getAttribute("method") === "dialog" || ((_a = event.submitter) == null ? void 0 : _a.getAttribute("formmethod")) === "dialog") {
4949
event.preventDefault();
50+
evaluate();
5051
}
5152
}
5253
function escapeDialog(event) {
53-
if (event.key === "Escape" && !canEvaluate) {
54+
if (event.key !== "Escape") return;
55+
if (closeBy === "none" || !canEvaluate) {
5456
event.preventDefault();
5557
}
5658
}

dist/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
};
88
const canEvaluate = expression.length > 0;
99
const lockPageScroll = modifiers.includes("noscroll");
10-
const closeBy = el.hasAttribute("closeby") ? el.getAttribute("closeby") : modifierValue(modifiers, "closeby", "closerequest");
10+
const closeBy = el.getAttribute("closeby") || modifierValue(modifiers, "closeby", "closerequest");
1111
el.style.display = null;
1212
el.style.length === 0 && el.removeAttribute("style");
1313
if (el._x_isShown) {
@@ -20,12 +20,14 @@
2020
document.body.style.overflow = use ? "hidden" : "";
2121
}
2222
function dialogSubmit(event) {
23-
if ((event.target.getAttribute("method") === "dialog" || event.submitter?.getAttribute("formmethod") === "dialog") && !canEvaluate) {
23+
if (event.target.getAttribute("method") === "dialog" || event.submitter?.getAttribute("formmethod") === "dialog") {
2424
event.preventDefault();
25+
evaluate();
2526
}
2627
}
2728
function escapeDialog(event) {
28-
if (event.key === "Escape" && !canEvaluate) {
29+
if (event.key !== "Escape") return;
30+
if (closeBy === "none" || !canEvaluate) {
2931
event.preventDefault();
3032
}
3133
}

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function dialog_default(Alpine) {
66
};
77
const canEvaluate = expression.length > 0;
88
const lockPageScroll = modifiers.includes("noscroll");
9-
const closeBy = el.hasAttribute("closeby") ? el.getAttribute("closeby") : modifierValue(modifiers, "closeby", "closerequest");
9+
const closeBy = el.getAttribute("closeby") || modifierValue(modifiers, "closeby", "closerequest");
1010
el.style.display = null;
1111
el.style.length === 0 && el.removeAttribute("style");
1212
if (el._x_isShown) {
@@ -19,12 +19,14 @@ function dialog_default(Alpine) {
1919
document.body.style.overflow = use ? "hidden" : "";
2020
}
2121
function dialogSubmit(event) {
22-
if ((event.target.getAttribute("method") === "dialog" || event.submitter?.getAttribute("formmethod") === "dialog") && !canEvaluate) {
22+
if (event.target.getAttribute("method") === "dialog" || event.submitter?.getAttribute("formmethod") === "dialog") {
2323
event.preventDefault();
24+
evaluate();
2425
}
2526
}
2627
function escapeDialog(event) {
27-
if (event.key === "Escape" && !canEvaluate) {
28+
if (event.key !== "Escape") return;
29+
if (closeBy === "none" || !canEvaluate) {
2830
event.preventDefault();
2931
}
3032
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fylgja/alpinejs-dialog",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Bring the power of AlpineJs to the HTML dialog",
55
"homepage": "https://fylgja.dev/",
66
"author": "Fylgja",

0 commit comments

Comments
 (0)