vimium-c icon indicating copy to clipboard operation
vimium-c copied to clipboard

Extensions captures keyboard shortcuts from inside a Web Assembly app.

Open RPicster opened this issue 3 years ago • 4 comments

Describe the bug

When using a web assembly application (example: The web based game editor of the Godot Engine https://editor.godotengine.org/releases/latest/) it captures all keypresses as Vimium shortcuts.

To Reproduce

  1. Go to https://editor.godotengine.org/releases/latest/
  2. Press "Start Godot editor"
  3. Press "NewProject"
  4. Enter "Hello" as the project name.

Browser, OS and Vimium C versions

  • Browser name: Chrome
  • Browser version: 102.0.5005.115
  • Vimium C version: 1.98.3
  • OS name and version: Windows 1

RPicster avatar Jun 28 '22 17:06 RPicster

This means such pages don't use hidden editable text boxes to capture keyboard events, and then Vimium C can not learn it should not grab keyboard events as usual - in the URL above, the page draw all UI components using <canvas> by itself.

You may open Vimium C Options, configure Excluded URLs and keys to make Vimium C disable itself on some URLs.

Or try the command named enterInsertMode (mapped to i by default) when you find Vimium C grabs keys unexpectedly. Ane <esc> can exit a default enterInsertMode. If you write map xxx enterInsertMode key="<a-?>", then only <a-?> (Alt+Shift+/) can exit it.

There're some ways to turn on/off Vimium C easily using a same key, and please see https://github.com/gdh1995/vimium-c/wiki/Enable-or-Disable-all-frames-by-a-shortcut .

gdh1995 avatar Jun 28 '22 17:06 gdh1995

Can you give me an example of how such a website that runs completely inside a <canvas> element could make use of a hidden textbox to avoid that behaviour of Vimium?

RPicster avatar Jun 29 '22 07:06 RPicster

  1. Create an <input type=text>
  2. make the input opacity: 0 or left: 10000px
  3. make the input focused, and listen its keydown and keyup events to call event.preventDefault() on almost all keys
  4. then Vimium C will know an input is focused so it should not apply key mappings, and the page itself can receive all keys

Some pages may use an <iframe> with <body contenteditable=true> to grab keyboard focus, which is even stronger then the above method.

gdh1995 avatar Jun 29 '22 15:06 gdh1995

Any new question or suggestion about this?

gdh1995 avatar Aug 10 '22 09:08 gdh1995