Skip to content

Commit e5c0d91

Browse files
committed
MAGE-985 Track user interactions to prevent alarming redirect behavior
1 parent abab74d commit e5c0d91

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

view/frontend/web/js/instantsearch.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ define([
3030

3131
dynamicWidgets: [],
3232

33+
hasInteracted: false,
34+
3335
///////////////////////////
3436
// Main build functions //
3537
///////////////////////////
@@ -425,6 +427,7 @@ define([
425427
placeholder: algoliaConfig.translations.searchFor,
426428
showSubmit : false,
427429
queryHook : (inputValue, search) => {
430+
this.hasInteracted = true;
428431
if (
429432
algoliaConfig.isSearchPage &&
430433
!algoliaConfig.request.categoryId &&
@@ -1064,12 +1067,14 @@ define([
10641067
},
10651068

10661069
getRedirectWidget() {
1070+
const uiComponnent = this;
10671071
return {
10681072
render({ results }) {
10691073
if (
10701074
results &&
10711075
results.renderingContent &&
1072-
results.renderingContent.redirect
1076+
results.renderingContent.redirect &&
1077+
!uiComponnent.hasInteracted
10731078
) {
10741079
window.location.href = results.renderingContent.redirect.url;
10751080
}

0 commit comments

Comments
 (0)