0

Duckduckgo.com has keyboard navigation that lets you hit the left and right arrows to go from web results, to image results, news and maps. All good, except when I'm browsing using my wacom tablet. If I scroll with the tablet and I accidentally scroll just a little bit left or right it sends left and right arrow keypresses, which means that the search results are swapping between all the modes. It makes DDG kinda unuseable with a tablet.

I wrote a tampermonkey script to disable the keydown events, but while it disables the left and right arrows in the search box text input, it doesn't prevent the dreaded left and right navigation.

// ==UserScript==
// @name         disable left-right arrows in DDG
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  the left and right scrolling in DDG is annoying when you're using a tablet
// @author       stib
// @match        https://duckduckgo.com/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    document.onkeydown=function(keydn){
        if ((keydn.key === "ArrowRight") || (keydn.key === "ArrowLeft")) {
            keydn.cancelBubble = true;
            keydn.preventDefault();
            return false;
        }
    }
})();
stib
  • 3,346
  • 2
  • 30
  • 38
  • You might need to look for the specific event catched by the Left/Right navigation, which could have a different name than `onkeydown`. My suggestion would be to use Firefox devtools for its `event listener` feature (https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Examine_event_listeners) – Adriano Jul 30 '19 at 02:22
  • ahh, that makes sense. – stib Jul 30 '19 at 02:50
  • In what way this is Tampermonkey-related? Is this just your installed userscript manager? – user598527 Dec 22 '21 at 13:01
  • Yes, that's what I used as a workaround. Should I delete that tag? – stib Dec 23 '21 at 13:11
  • @stib I believe so. – user598527 Jan 15 '22 at 09:50

0 Answers0