From 518b77a65ee39fb4b78ac8a3ea4c56f391712e11 Mon Sep 17 00:00:00 2001
From: Christian Adamski <7689-ChristianAdamski@users.noreply.drupalcode.org>
Date: Mon, 10 Mar 2025 13:53:44 +0000
Subject: [PATCH] #3511987 address selector

---
 .../js/WidgetSubscriber/GeolocationAddressWidget.js       | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/geolocation_address/js/WidgetSubscriber/GeolocationAddressWidget.js b/modules/geolocation_address/js/WidgetSubscriber/GeolocationAddressWidget.js
index d5e853aa..c1874bae 100644
--- a/modules/geolocation_address/js/WidgetSubscriber/GeolocationAddressWidget.js
+++ b/modules/geolocation_address/js/WidgetSubscriber/GeolocationAddressWidget.js
@@ -47,15 +47,17 @@ export default class GeolocationAddressWidget extends FieldWidgetBase {
 
   getAllInputElements(returnElements = false) {
     const hyphenatedFieldName = this.settings.field_name.replaceAll("_", "-");
-    const pattern = new RegExp(`^edit-${hyphenatedFieldName}-\\d+$`);
+    const pattern = new RegExp(`${hyphenatedFieldName}-\\d+$`);
 
-    const map = new Map();
-    const elements = this.form.querySelectorAll(`details[data-drupal-selector*="${this.settings.field_name.replaceAll("_", "-")}-"]`);
+    const elements = Array.from(this.form.querySelectorAll(`[data-drupal-selector*="${hyphenatedFieldName}-"]`)).filter((element) => {
+      return pattern.test(element.getAttribute("data-drupal-selector"));
+    });
 
     if (returnElements) {
       return elements;
     }
 
+    const map = new Map();
     elements.forEach((element) => {
       map.set(this.getIndexByElement(element), element);
     });
-- 
GitLab