Can't use Ctrl-G in scripts


#1

Brave seems to capture certain keystrokes and interfere with javascript functions, but in unpredictable ways. Ctrl-G seems always to bring up the “Find Next” dialogue, even when JavaScript should prevent default behavior. The same is not so for Ctrl-F or Ctrl-H strangely enough. You can test this with the following code:

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <title>Page title</title>
      <script>
         window.onload = function() {
            document.body.addEventListener("keydown", function(evt) {      
               if ((evt.keyCode == 71) && (evt.ctrlKey)) {
                  evt.preventDefault();
                  document.body.innerHTML="You pressedd Ctrl-G";
               }              
               if ((evt.keyCode == 72) && (evt.ctrlKey)) {
                  evt.preventDefault();
                  document.body.innerHTML="You pressedd Ctrl-H";
               }
            });
         }
      </script>
   </head>
   <body>
      Hello world!
   </body>
</html>

If you load the above page, the Ctrl-H works, but not the Ctrl-G.

Now perhaps Brave is intentionally preventing scripts from intercepting certain keystrokes, but it seems to be doing so inconsistently. And if I can’t get past this, it makes the browser useless to me if my own webapps don’t work as expected.

My version:

Version Information
Name	Version
Brave	0.15.0
rev	de2561a
Muon	2.58.7
libchromiumcontent	58.0.3029.81
V8	5.8.283.32
Node.js	7.9.0
Update Channel	dev
os.platform	linux
os.release	4.10.11-1-ARCH

os.arch x64


Still can't use Ctrl-G in scripts
#2

Sorry for the delayed response but it seems to work fine for me. Shows me You pressedd Ctrl-H when i press Ctrl+H.


#3

Sorry you seem to have missed the point. The problem is that it does work for Ctrl-H but doesn’t work for Ctrl-G.

I haven’t tested every combination, but the behavior should not be so inconsistent.


#4

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.