Skip to content

Commit

Permalink
Ignore auto-repeat events in ctrl keydown event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jun 19, 2022
1 parent d96f5b5 commit d003648
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/js/popup-fenix.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d003648

Please sign in to comment.