Closed Nirudha closed 2 years ago
Happens especially often on Wikipedia
When I browse wikipedia pages, this addon sometimes goes back two wikipedia pages
I know why the bug happens: its because lastswipe is not persisted when navigating, every content script on every page has its own variables.
So when I go back on a page and the browser navigates back one page, if my fingers are still on the trackpad swipping, it will go back again, since the difference between Date.now() and last swipe variable is greater than 1000. (The lastSwipe variable is holding the value 0 or some old value on that page).
The way I know that is that I tested pasting window.history.back(); window.history.back(); window.history.back(); in the devtools console and the browser only went back one page, so its not the event triggering on one page repeatedly, but on diffferent pages, driving to the conclusion in the previous comment.
I wrote a fix for this, will prepare a pull request. ¨
Happy to hear that! Have tried to message the lastSwipe to previous pages to fix the issue with multiple navigation events.
Thanks to @artisticfox8 for fixing the issue with multiple navigation events. Updated and pushed the add-on to Mozilla
Sometimes a swipe generates more than one click of the back or forward button. I tried reducing the sensitivity to see if this helps but that just changes the threshold of detection. I still see multiple back forward movements.
Perhaps there should be an option to only generate one back/forward event per swipe?