Skip to content

Commit d9cf6e0

Browse files
authored
Merge pull request #1015 from Patternslib/fix-close-panel
fix(pat close panel): Do not break if no parent .has-close-panel elem…
2 parents 87347b7 + 894c05c commit d9cf6e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pat/close-panel/close-panel.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ export default Base.extend({
66
trigger: ".close-panel",
77

88
init() {
9-
this.el.addEventListener("click", async (e) => {
9+
this.el.addEventListener("click", (e) => {
1010
// Find the first element which has a close-panel.
1111
// This should the panel-root itself.
1212
const panel = this.el.closest(".has-close-panel");
1313

14+
if (!panel) {
15+
// No ``.has-close-panel``. Exiting.
16+
return;
17+
}
18+
1419
// Get the close panel method.
1520
const close_method = dom.get_data(panel, "close_panel");
1621

0 commit comments

Comments
 (0)