codemirror-vim icon indicating copy to clipboard operation
codemirror-vim copied to clipboard

`<C-d>` in Safari on iPad does not work

Open kometenstaub opened this issue 2 years ago • 4 comments

<C-d> (Ctrl-d) in Safari on iPad does not work. (It should scroll down.)

It doesn't do anything the first time, the second time it deletes the whole line. It seems to me as if the Ctrl isn't recognised, and instead only the d is passed through, so it deletes the full line on second invocation, like dd.

I've tried it here: https://raw.githack.com/replit/codemirror-vim/noremap/dev/web-demo.html I've used the keyboard from my MacBook with Apple's keyboard and mouse sharing feature.

macOS 13.3.1 iPadOS 16.4.1

<C-f> and others work, though. Might this be a conflict with Ctrl-d on iPadOS (the delete operation, the opposite of backspace)? On macOS, it is handled correctly in Safari.

kometenstaub avatar Apr 23 '23 18:04 kometenstaub

This is a bug in codemirror itself, as it does not handle keyboard modifiers on ios, and after user pressing ctrl-d, dispatches an event for simple d keydown see https://github.com/codemirror/view/blob/edb60581119d69d9d3b6bf246224268a36d0376b/src/input.ts#L196 which calls dispatchEvent with just a key, ignoring the modifiers

nightwing avatar Apr 30 '23 14:04 nightwing

So why do other commands like C-f work?

What I’m trying to understanding is why some commands with Ctrl work, but this one doesn’t.

kometenstaub avatar Apr 30 '23 16:04 kometenstaub

This happens only for keys that change text in the editor. Try :map <C-k> rx and :map <C-j> rx. to see the difference.

nightwing avatar Apr 30 '23 18:04 nightwing

Looks like this issue still persists (running the Obsidian iPad app in visionOS, which uses codemirror-vim for its Vim key bindings). Any recommended workarounds or known paths for this to be fixed? If this key modifier behavior is an iOS/iPadOS limitation, then that's understandable.

Backlink to the Obsidian bug report, for convenience: https://forum.obsidian.md/t/vim-mode-ctrl-d-navigation-is-still-broken-on-ipados/40262

dansalvato avatar Feb 15 '24 19:02 dansalvato