Last active
July 5, 2022 14:10
-
-
Save splintor/c56f9ba873ce14d2efc1b6238993de8d to your computer and use it in GitHub Desktop.
WhatsApp - restore focus to search box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name WhatsApp - restore focus to search box | |
// @namespace https://splintor.github.io/ | |
// @version 0.2 | |
// @description When user clears search box, focus moves to the first entry in the list. It's annoying! | |
// @author Shmulik Flint | |
// @match https://web.whatsapp.com/ | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com | |
// @downloadURL https://gist.githubusercontent.com/splintor/c56f9ba873ce14d2efc1b6238993de8d/raw | |
// @updateURL https://gist.githubusercontent.com/splintor/c56f9ba873ce14d2efc1b6238993de8d/raw | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.body.addEventListener('keydown', e => { | |
if (e.target.classList.contains('selectable-text')) { | |
setTimeout(() => e.target.focus(), 100); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment