Prevent going to the next page in presentation mode when closing the context menu

Fixes #3276.

I couldn't find a way to check whether the context menu was opened, so keeping track of right clicks seemed like a good enough workaround.