From 894c05c9995a120cc53305d76d2ac1c69ac30b9e Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Thu, 2 Jun 2022 20:39:42 +0200 Subject: [PATCH] fix(pat close panel): Do not break if no parent .has-close-panel element was found. --- src/pat/close-panel/close-panel.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pat/close-panel/close-panel.js b/src/pat/close-panel/close-panel.js index 6fcd9b514..3ce8561d2 100644 --- a/src/pat/close-panel/close-panel.js +++ b/src/pat/close-panel/close-panel.js @@ -6,11 +6,16 @@ export default Base.extend({ trigger: ".close-panel", init() { - this.el.addEventListener("click", async (e) => { + this.el.addEventListener("click", (e) => { // Find the first element which has a close-panel. // This should the panel-root itself. const panel = this.el.closest(".has-close-panel"); + if (!panel) { + // No ``.has-close-panel``. Exiting. + return; + } + // Get the close panel method. const close_method = dom.get_data(panel, "close_panel");