mrgreekgeek / abbott-smith-greek-lexicon-online

A little JS app to make Abbott-Smith searchable and usable with a focus on good UI and UX
https://lexicon.mrgreekgeek.com
MIT No Attribution
2 stars 0 forks source link

Back/Forward buttons don't work for navigating search history #11

Open mrgreekgeek opened 1 month ago

mrgreekgeek commented 1 month ago

Ideally if I search for more than one word, the browser's back button should take me back to the previously searched word. Currently the URL does change, but it doesn't actually update the page.

welcome-me commented 1 month ago

Is this a regression/ did this use to work?

mrgreekgeek commented 1 month ago

I don't know for sure. 😢 My guess is that it hasn't ever worked.

welcome-me commented 1 month ago

image

It looks like we want to fire Search for the popstate event.

This code in window.onload should be written as a lambda and called for both by popstate and onload.

        //search for any provided terms
        let urlSearchTerm = getURLParameter('search');
        if (urlSearchTerm) {
            domSearchInput.value = urlSearchTerm;
            search(urlSearchTerm);