fix stuck search

This commit is contained in:
Cory LaViska
2023-08-25 09:35:05 -04:00
parent 0cb6aa5d12
commit cf195da424

View File

@@ -373,4 +373,12 @@
hide();
}
});
// We're using Turbo, so when a user searches for something, visits a result, and presses the back button, the search
// UI will still be visible but not interactive. This removes the search UI when Turbo renders a page so they don't
// get trapped.
window.addEventListener('turbo:render', () => {
document.body.classList.remove('search-visible');
document.querySelectorAll('.search__overlay, .search__dialog').forEach(el => el.remove());
});
})();