Interaction Manager - Blocs 6 Plus ⚡️

Norm,

We really need Interactions export.

I just spent quite some time creating a custom bloc with 20 custom interactions and I was super disappointed to find out the interactions associated with the bloc didn’t come with it when exported it as a custom bloc.

1 Like

@Norm For my company, I built an academy using VOLT. I use the Interaction feature to make a search cancel button appear after one of the search buttons is pressed, and it works perfectly. However, how can I make the cancel button visible when using the Volt Blog Search function?

I’m not sure how Volt search works. :sweat_smile:

@Norm Let me break it down for you: when a VOLT search string is submitted, the page reloads. Any idea how to detect the search event post-refresh using an Interaction to make the cancel button visible? Or is this a limitation of your Interaction Manager?

Do you have a live website I can take a look at?

Is the page being reloaded?

Hi @Norm
FYI, I got it working by adding JavaScript to a code widget.

What code did you add?

Here you go:

<script>
document.addEventListener("DOMContentLoaded", function () {
    let searchForm = document.getElementById("form_5071"); // Get search form
    let cancelDiv = document.getElementById("cancel"); // Get cancel div

    // Check if search was previously triggered
    if (localStorage.getItem("searchTriggered") === "true") {
        cancelDiv.style.display = "block"; // Show cancel div after page refresh
    }

    if (searchForm && cancelDiv) {
        searchForm.addEventListener("submit", function () {
            localStorage.setItem("searchTriggered", "true"); // Store search state
        });
    }

    // Hide cancel div and reset state when cancel button is clicked
    let cancelButton = document.querySelector("#cancel a");
    if (cancelButton) {
        cancelButton.addEventListener("click", function () {
            cancelDiv.style.display = "none"; // Hide cancel div
            localStorage.removeItem("searchTriggered"); // Reset search state
        });
    }
});
</script>

1 Like

Ah ok so you would need to check for the existence of the searchTriggered Local Storage key value.

I actually have some of this functionality prepared for the Interaction Manager, it’s just disabled at the moment until I have finished it off :sweat_smile:.

Local Storage will work similar to how you create and check for cookies in the Interaction Manager.

Hopefully, I will have this available later in the year.

I’ll bookmark this and circle back when Interaction Manager can handle this :sunglasses:.

2 Likes