Unmapped ESC key changes focus
-
Using Vivaldi to remote web RDP and using VIM on the end client. Need the ESC key to pass in ESC and not perform any other action. I successfully, unmapped it in the settings-> keyboard config and it is now passing in ESC, but it is also removing focus from the page (have to mouse click back in). Any idea how to prevent that from happening (or at minimum is there another configurable hotkey to put the focus back in)?
Thanks!
-
Hello
@krg9898
Welcome to the Vivaldi forums and community. We are always happy to help and advise you on how to get the most out of the internet using Vivaldi.
The browser has functions for what you need to do. For example, there are keyboard shortcuts (or specific behaviors) that you can modify yourself.
In the keyboard section you can configure what each key does. You can also configure ESC.
-
This doesn't answer my question. I know you can configure the keyboard. I already went to keyboard shortcut configuration screen and un-mapped ESC from the "Stop loading" function that it defaults to. When I did this, it does pass the ESC key to the underlying page, but it also changes the focus out of the page. That is the problem.
-
Natively I can't think of any options, since the behavior comes from Chromium. You could investigate how to do it from there or directly from the operating system (remapping the keys from Windows).
-
I don't have the same issue (ESC changing focus) in either Edge or Chrome. So I think this is a problem with Vivaldi specifically.
-
@krg9898 Could you share a link to a website where this issue occurs? I did some tests on my own, and for me, the
[ESC]
key seems to give the same results in both Edge and Vivaldi - but I guess it's a matter of choosing the right test case.Vivaldi is built a little bit different than other Chromium browsers, as it adds its own UI "layer" on top of Chromium, and perhaps that's what's causing the issue (but that's just a guess).
Anyway, I don't think that unbinding the
[ESC]
should be necessary in your case (unless it's obstructing the website you're using in some way), but since you already did that, you could try this: create a command chain, select the "Focus Page" command, and assign it to the[ESC]
key in Settings. Let me know if that works for you.For a more permanent solution, you'd have to report a bug, if you have a reliable test case that we could work with.
-
Tried the chain command. Didn't have any affect. It's hard for me to setup a test case since this is corporate system. It's a somewhat complex setup. I'm using the browser to connect to an Azure remote desktop webclient. The web rdp is then connecting to a windows server and on the windows server I am using putty to connect to a linux system. It is in this putty window that I need ESC to just be the ESC key. Currently, ESC is passing in the ESC key code, but at the same time, the focus moves away from the "page", and I have to use the mouse to click back in the middle of the browser window to get it back in.
I was originally using Edge to do this work. The ESC issue does not exist there, but I had a different problem with a different key combination. When I'm connected to the linux system, I need CTRL-N to also not do any special action and just be passed through. Unfortunately, in Edge (and Chrome), you cannot remap CTRL-N away from the browser's "New Window" functionality. That's why I switched to Vivaldi, I could unmap the CTRL-N default functionality. Unfortunately, Vivaldi introduced this weird ESC behavior.
-
@krg9898 I can easily reproduce the issue on this forum.
I have a single-key shortcut assigned to show/hide the status bar. As expected, I can type "s" in this text edit field. If I press Escape, then "s" will show/hide the status bar, again as expected.
However, I see no way to refocus the text edit field without using the mouse.
-
@krg9898 I see. Did you try mixing it with other commands, eg. "Focus address field" and then "Focus page"? What happens if you use the
[TAB]
key? -
@pesala said in Unmapped ESC key changes focus:
I see no way to refocus the text edit field without using the mouse.
I can refocus the text field in such a scenario by pressing
[TAB]
and then[SHIFT]
+[TAB]
. I believe OP's issue is different. -
Yeah, for me, using the TAB key after ESC removes the focus from the page, tabs beteween the vivaldi fields and some of the remote web desktop web fields. Doesn't move the focus back to the main web page though.
-
@krg9898
[TAB]
should return focus to the webview at some point (same with[SHIFT]
+[TAB]
). Did you try to run through all the focusable elements? What are your settings in Webpages > Webpage focus? -
I have the same problem, specifically with using VIM. One case where you can see the behavior is using Visual Studio Code in the browser (which is my use case actually - I really use it a lot and this ESC misbehavior is the reason I don't use Vivaldi).
To reproduce go to https://vscode.dev and install the VIM extension. Then create a new file, go to insert mode. Then try to leave the insert mode with ESC. It just loses focus. When clicking pack into the text area it is still in insert mode.
As a side note: if I install VSCode to Desktop (right click on tab, "Install Visual Studio Code", i.e. as a Desktop PWA) it does not show this weird ESC behavior and the button works as expected.
-
This makes Vivaldi nearly unusable for me. I use Vim bindings on hackmd.io to be productive and hitting escape completely defocuses the page. This does not happen in Chromium or Firefox. I don't care what happens in Edge, I don't consider Edge a legitimate browser anyway nor do I use it. Escape shouldn't hijack the page like that.
This is a huge dealbreaker for me, unfortunately
-
I'm a CJK user, and I use input method all the time.
In input method, ESC is a very frequently used key, but Vivaldi has hijacked the functionality of the ESC key. -
At least for the HackMD case, the underlying CodeMirror 5 does not call preventDefault (see comment at https://github.com/codemirror/codemirror5/issues/7056#issuecomment-1732334071). As I said there, one might blame Vivaldi, but I really appreciate it adding this behavior to texareas, because of my Vim habits.
So until CodeMirror handles that and has landed on HackMD and other sites using it, I'm settling for a UserScript.
If you trust this "hack", put this in a file named e.g.
codemirror-handle-vim-esc.user.js
and drop it into yourvivaldi://extensions/
area:// ==UserScript== // @name codemirror-handle-vim-esc.user.js // @version 0.1 // @description Support Esc key in CodeMirror Vim Mode by preventing propagation Vivaldi blur event. // @match http://*/* // @match https://*/* // ==/UserScript== (function () { function addEscListener(evt) { window.removeEventListener('load', addEscListener); const cm = document.querySelector('.CodeMirror'); if (cm) { const textarea = cm.querySelector('textarea'); textarea.addEventListener('keydown', evt => { if (evt.key === 'Escape') evt.stopPropagation(); }); } } window.addEventListener('load', addEscListener); }());
(Like regular extension it will execute on every site you visit. I tried to made it unobtrusive (most extensions do far more), but you might want to edit the
@match
clause or use@include
instead. (I just learned of Vivaldi's handy drag&drop support for userscripts, so there's probably more options here.))The cautious user might prefer a classic bookmarklet instead, like:
javascript:void((function(){ document.querySelector('.CodeMirror').CodeMirror.getInputField().addEventListener('keydown', evt => { if (evt.key === 'Escape') evt.stopPropagation(); }); })())
.