Fix the Auto Scroll Issue on Laptops running Linux

by Mayank

If you’re running a Linux distribution on your laptop, you may have faced a problem where, when you scroll to the bottom of the page, the page will automatically be scrolled back to the top, and you won’t be able to scroll it back to the position you want. This problem happens with the File Manager, any Webpage, Text Editor (where the cursor is automatically sent to the start of the line again and again), and everywhere else. To know what the problem looks like, I have embedded a video of the problem below so that you can relate to the issue you’re facing.

Notice how I can’t scroll down on YouTube even when I’m dragging the scroll bar

At first, you might think that this issue is related to your touchpad, which may be true in some cases, but the touchpad issue is not always the reason for this problem. I’ve experienced this problem myself on my own LXDE desktop environment, and I know this issue is really frustrating for both new and experienced users. When I had this problem, I tried to search through a variety of forums, but there was no solution for me. That’s when it hit me- What if there’s a problem with the keyboard? I gave it some thought and then I realized that maybe the Page Up key is stuck and that’s causing the problem. So, I disabled my laptop keyboard and used an external wired keyboard, and the problem was gone.

As it turned out, laptop keyboards are very fragile and prone to long-run problems compared to desktop keyboards. You can go ahead and disable the keyboard on your laptop and use the USB keyboard, but that’s not feasible. Also, before you run to a hardware store to get a new keyboard installed, listen to me for a second. It’s not a good reason to replace the entire keyboard due to a defect in one or two keys. So, I figured out a workaround. Here I’m going to give you a perfectly working fix that will solve this problem permanently.

The best way to solve this problem is identifying and disabling the key/keys which are causing this issue.

Diagnosing the Issue

  • First, let’s check which keys are causing the problem. I know the perfect tool to do this. Go to this link: https://www.keyboardtester.com/
  • Click Launch the Tester.
  • Start pressing each key on your keyboard one by one. You ‘re also going to get a sound output from this tool. Every key that you press will turn green to indicate that the key is working fine.
fix-keyboard-2
  • Be sure to test the Page Up, Page Down, Home, End keys as they are the ones with the greatest chance of causing this problem.
  • In my case the Home and End keys were causing the problem.
  • If a key is faulty, the key will continuously turn green and orange even if you press the key only once. A series of clicking sounds will follow. If this happens with multiple keys, then all those keys are the reason for the problem. Remember the names of the faulty keys.
  • Congratulations, you are halfway through solving the problem.

Fixing the Issue

Now that we’ve diagnosed and identified the bad keys from your keyboard, the next step is to disable them so that they won’t cause any more problems again.

Don’t worry you can re-enable them later if you want

  • Open the terminal.
  • To disable a key, we first need to know which keycode is mapped to the key..
  • To know the keycode, enter the command

xmodmap -pke | grep -i NAME_OF_THE_KEY

  • In my case the Home and End keys were causing the problem so I ran:

xmodmap -pke | grep -i home

xmodmap -pke | grep -i end

  • The number in front of Keycode is what we’re looking for. Copy that number.
  • Now that we have identified the keycode corresponding to the bad key, the final step is to disable it.
  • Enter the command

xmodmap -e “keycode ENTER_THAT_NUMBER_HERE= “

  • This is how I disabled the Home and End keys on my laptop’s keyboard.
  • You can check to see if the key has in fact been disabled. Just enter the command

xmodmap -pke

  • Scroll to the corresponding keycode you used earlier.
  • As you can see when I disabled the Home key (Keycode 110) and the End key (Keycode 115), the key value is now empty which means I have successfully disabled them. Voila! You have fixed the problem. Now you won’t get the auto scrolling problem again.

Bonus: How to Re-Enable the keys

To re-enable the key/keys you disabled earlier, just enter the command

xmodmap -e “keycode ENTER_THE_KEYCODE_HERE= KEY_NAME”

So, were you able to solve this issue on your laptop? Comment below and let me know. Also, share this article with your friends who are facing the same problem and help them.

Related Posts

Leave a Comment