Ignore auto-repeat events in ctrl keydown event handler

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2145
This commit is contained in:
Raymond Hill 2022-06-19 11:52:23 -04:00
parent d96f5b55b6
commit d00364860c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 0 deletions

View File

@ -1259,6 +1259,9 @@ const toggleHostnameSwitch = async function(ev) {
*/
// https://github.com/uBlockOrigin/uBlock-issues/issues/2145
// Ignore events from auto-repeating keys
{
let eventCount = 0;
let eventTime = 0;
@ -1268,6 +1271,7 @@ const toggleHostnameSwitch = async function(ev) {
eventCount = 0;
return;
}
if ( ev.repeat ) { return; }
const now = Date.now();
if ( (now - eventTime) >= 500 ) {
eventCount = 0;