From 648517339aa54662410ed8d98cdca9928f190f49 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Fri, 21 Jun 2024 10:29:46 +0200
Subject: [PATCH] fix: #201

---
 source/components/host/call-button.mjs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/source/components/host/call-button.mjs b/source/components/host/call-button.mjs
index 059804265..0be9dd426 100644
--- a/source/components/host/call-button.mjs
+++ b/source/components/host/call-button.mjs
@@ -20,7 +20,7 @@ import {
 } from "../../dom/customelement.mjs";
 import { CallButtonStyleSheet } from "./stylesheet/call-button.mjs";
 import { isArray, isObject, isFunction } from "../../types/is.mjs";
-import { getDocument } from "../../dom/util.mjs";
+import {findElementWithSelectorUpwards, getDocument} from "../../dom/util.mjs";
 import { ATTRIBUTE_PREFIX } from "../../dom/constants.mjs";
 
 export { CallButton };
@@ -200,7 +200,6 @@ function initOptionsFromArguments() {
  * @throws {Error} The option references.callableSelector must be an array
  */
 function initEventHandler() {
-	const doc = getDocument();
 
 	this[callButtonElementSymbol].addEventListener("click", (event) => {
 		event.preventDefault();
@@ -218,7 +217,7 @@ function initEventHandler() {
 		}
 
 		for (const selector of selectors) {
-			const element = doc.querySelector(selector);
+			const element = findElementWithSelectorUpwards( this,selector);
 			if (element instanceof HTMLElement && isFunction(element?.[call])) {
 				element[call]();
 			}
-- 
GitLab