Skip to content

Commit 2fefcf9

Browse files
authored
[6.0] Searchtools use requestSubmit() and add joomla:update listener (#44496)
* Replace form submit with requestSubmit and add joomla:update event listener * Add check and fallback if requestSubmit is not available
1 parent f483db0 commit 2fefcf9

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

build/media_source/system/js/searchtools.es6.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ Joomla = window.Joomla || {};
3838
elem.value = '';
3939
});
4040

41-
form.submit();
41+
if (form.requestSubmit) {
42+
form.requestSubmit();
43+
} else {
44+
// Fallback if requestSubmit is not available
45+
form.submit();
46+
}
4247
}
4348
};
4449

@@ -187,7 +192,12 @@ Joomla = window.Joomla || {};
187192
i.addEventListener('change', () => {
188193
self.checkFilter(i);
189194
if (i.classList.contains(this.options.listSelectAutoSubmit) || needsFormSubmit) {
190-
i.form.submit();
195+
if (i.form.requestSubmit) {
196+
i.form.requestSubmit();
197+
} else {
198+
// Fallback if requestSubmit is not available
199+
i.form.submit();
200+
}
191201
}
192202
if (i.classList.contains(this.options.listSelectAutoReset) || needsFormReset) {
193203
this.clear(i);
@@ -225,7 +235,12 @@ Joomla = window.Joomla || {};
225235
self.toggleDirection();
226236
}
227237

228-
self.theForm.submit();
238+
if (self.theForm.requestSubmit) {
239+
self.theForm.requestSubmit();
240+
} else {
241+
// Fallback if requestSubmit is not available
242+
self.theForm.submit();
243+
}
229244
}
230245
});
231246
});
@@ -288,7 +303,12 @@ Joomla = window.Joomla || {};
288303
}
289304
}
290305

291-
self.theForm.submit();
306+
if (self.theForm.requestSubmit) {
307+
self.theForm.requestSubmit();
308+
} else {
309+
// Fallback if requestSubmit is not available
310+
self.theForm.submit();
311+
}
292312
}
293313

294314
updateFilterCount(count) {
@@ -564,6 +584,9 @@ Joomla = window.Joomla || {};
564584
sort.parentNode.setAttribute('aria-sort', ariasort);
565585
}
566586

587+
// Reinitialize for Joomla Updated event
588+
document.addEventListener('joomla:updated', onBoot);
589+
567590
// Cleanup
568591
document.removeEventListener('DOMContentLoaded', onBoot);
569592
};

0 commit comments

Comments
 (0)