Esc in VIM mode unfocuses code editor in Vivaldi browser #7056

Open
opened 2023-08-24 15:10:16 +02:00 by marijnh · 4 comments
marijnh commented 2023-08-24 15:10:16 +02:00 (Migrated from gitlab.com)

Specs

OS: Windows 11 Pro
Browser: Vivaldi 6.1.3035.302 (Stable channel) (64 bites)
CodeMirror version: 5

Bug description

I can't use VIM mode because every time I press Esc, it pops out of the text box instead of just going into normal mode.

To Reproduce

  1. Open the codemirror VIM test site in Vivaldi!
  2. Click in the code box! You are NORMAL MODE by default.
  3. Press i to enter INSERT MODE!
  4. Press Esc!

Expected behavior

The code box is expected to react to further inputs of user after return to NORMAL MODE with Esc key.

Additional information

I've tested it in Chrome, Firefox and Edge and I'm experiencing the bug in vivaldi alone.
I've tested it in incognito mode, with all add-ons and ad block disabled and the error is still present.

<!-- Do not use this bug tracker for questions. We have a forum (https://discuss.codemirror.net) for those. In order to get us to look at something, you need to make it easy for us to understand what you are doing and what went wrong. When possible, a code example that demonstrates the problem helps a lot. If there's any chance at all that a problem is related to the browser, include information about which browser(s) you tested with. --> ### Specs **OS:** Windows 11 Pro **Browser:** Vivaldi 6.1.3035.302 (Stable channel) (64 bites) **CodeMirror version:** 5 ### Bug description I can't use VIM mode because every time I press Esc, it pops out of the text box instead of just going into normal mode. ### To Reproduce 1. Open [the codemirror VIM test site](https://codemirror.net/5/demo/vim.html) in Vivaldi! 2. Click in the code box! You are `NORMAL MODE` by default. 3. Press `i` to enter `INSERT MODE`! 4. Press `Esc`! ### Expected behavior The code box is expected to react to further inputs of user after return to `NORMAL MODE` with `Esc` key. ### Additional information I've tested it in Chrome, Firefox and Edge and I'm experiencing the bug in vivaldi alone. I've tested it in incognito mode, with all add-ons and ad block disabled and the error is still present.
marijnh commented 2023-08-24 15:12:46 +02:00 (Migrated from gitlab.com)

If this browser doesn't let scripts intercept Esc presses, I don't think there's anything we can do about that.

If this browser doesn't let scripts intercept Esc presses, I don't think there's anything we can do about that.
marijnh commented 2023-08-24 15:25:46 +02:00 (Migrated from gitlab.com)

@marijnh , Seems to work fine here:
https://unixpapa.com/js/testkey.html

`@marijnh` , Seems to work fine here: https://unixpapa.com/js/testkey.html
marijnh commented 2023-09-23 16:46:41 +02:00 (Migrated from gitlab.com)

Scripts are able to capture Esc presses in Vivaldi. Vivaldi does however also automatically unfocus the backing textarea. Fortunately this is done sensibly, so it is stoppable by doing if (evt.key === 'Escape') evt.stopPropagation(). I think doing this in onKeyEventTargetKeyDown of codemirror5 Vim mode would solve this.

(One might blame Vivaldi here, but I really appreciate its default behavior, because of my Vim habits. Other browsers may follow suite (maybe Edge has already?), so it makes sense for codemirror to handle this.)

Scripts are able to capture `Esc` presses in Vivaldi. Vivaldi does however also automatically unfocus the backing textarea. Fortunately this is done sensibly, so it is stoppable by doing `if (evt.key === 'Escape') evt.stopPropagation()`. I think doing this in `onKeyEventTargetKeyDown` of codemirror5 Vim mode would solve this. (One might blame Vivaldi here, but I really appreciate its default behavior, *because* of my Vim habits. Other browsers may follow suite (maybe Edge has already?), so it makes sense for codemirror to handle this.)
marijnh commented 2023-11-26 17:18:59 +01:00 (Migrated from gitlab.com)

Same thing is happening for Leetcode + VIM keyboard binding

Same thing is happening for Leetcode + VIM keyboard binding
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#7056
No description provided.