FreeFem / FreeFem-doc

FreeFEM user documentation
https://doc.freefem.org
Other
131 stars 43 forks source link

Cumbersome to use documentation when switching between browser and terminal repeatedly #47

Open luspi opened 2 weeks ago

luspi commented 2 weeks ago

Describe the bug I am working through some of the examples and want to read the explanation and then run the example in a terminal. However, switching windows with Alt+Tab always toggles the search. And when I toggle the search again to get the documentation back, then the page is scrolled back to the top, i.e., I have to scroll back down to where I was a few seconds ago. This is rather annoying and costs quite a lot of time, especially since I'm switching windows a lot to tweak the examples based on what I'm reading in the documentation.

Expected behavior Using Alt+Tab to switch from browser to terminal does not mess with the documentation display. One idea might be to make this behavior optional?

Desktop (please complete the following information):

Thank you!

luspi commented 4 days ago

As a temporary workaround, this Greasemonkey script (inspired by this answer) can be used to disable the behavior of Alt here:

// @name           Disable Alt switch
// @description    Stop Alt from switching documentation
// @run-at         document-start
// @include        https://doc.freefem.org/*
// @grant          none
// ==/UserScript==

(window.opera ? document.body : document).addEventListener('keydown', function(e) {
    if (e.altKey) {
        e.cancelBubble = true;
        e.stopImmediatePropagation();
    }
    return false;
}, !window.opera);