remark42 icon indicating copy to clipboard operation
remark42 copied to clipboard

Hotkeys work in EN layout only

Open mykola-petiukh opened this issue 5 years ago • 9 comments

Repro: switch keyboard to other language than English and press Ctrl+B.

Demo on Youtube (clickable):

mykola-petiukh avatar Aug 02 '19 13:08 mykola-petiukh

We have hotkeys? :D

What system/browser? It seems to work on osx/firefox, though I hit cmd+b.

Also, can you check, if it works here on GitHub, since we use same package as github iirc

Reeywhaar avatar Aug 02 '19 22:08 Reeywhaar

yeah, I was shocked too :) Had to watch a video to figure out what hotkeys we have

umputun avatar Aug 02 '19 22:08 umputun

You can check out title on hover of each button, or just plain code :-) https://github.com/umputun/remark/blob/f0750c24335742da2b04cee6e38bbb67f972c44b/frontend/app/components/input/markdown-toolbar.tsx#L29-L37

Reeywhaar avatar Aug 02 '19 22:08 Reeywhaar

What system/browser?

Vivaldi 2.6.1566.49 (Stable channel) (64-bit) Windows 10 OS Version 1903 (Build 18362.267)

Github have the same issue.

mykola-petiukh avatar Aug 03 '19 10:08 mykola-petiukh

works for me on safari and chrome (both on macos).

umputun avatar Aug 03 '19 17:08 umputun

It also works for me on osx/Vivaldi 2.6.1566.49 (Stable channel) (64-bit)

So, I guess it's either Vivaldi or @github/markdown-toolbar-element

Code related to this here https://github.com/github/markdown-toolbar-element/blob/dd0ffba8d9ad9d64471d3be41b3b7e1b77aa3545/index.js#L228-L236

Screenshot 2019-08-04 at 16 52 12

Package adds hotkey attribute to element and then searches for it on keydown. And it seems there is mismatch between hotkey attr and event.key.

@NikolayPetyukh if you have skill, can you please check, what hotkey attribute if you click select inspect element on any of the toolbar button? And then, is event.key of keydown event property is different on EN and RU layouts? https://w3c.github.io/uievents/tools/key-event-viewer.html

Reeywhaar avatar Aug 04 '19 14:08 Reeywhaar

Chrome 76 on Windows 10. I confirm that the hotkeys only work on EN.

Screenshot_2

Screenshot_6

Screenshot_5

Andrew-Shtein avatar Aug 13 '19 22:08 Andrew-Shtein

@Andrew-Shtein, thanks!

As I expected on Windows key is different and it appears to be more close to spec. It's a markdown-toolbar-element issue. Made an issue there https://github.com/github/markdown-toolbar-element/issues/15

Reeywhaar avatar Aug 13 '19 23:08 Reeywhaar

Reply from linked issue:

@ muan not bug. That's not issue. It's expected, if you wanna create multilanguage support just add another hotkey data to div, for example:

[hotkey${currentKeyboardLang}="${event.key}"]

paskal avatar Mar 09 '20 22:03 paskal

We should not fix it on our side if the library doesn't support it: we then open a can of worms by trying to support the undocumented hotkey feature for dozens of languages we have. The only solution I think is appropriate is switching to another library which will do that.

Closing this as "won't fix", feel free to comment on the issue if your opinion differs from mine.

paskal avatar Jan 08 '23 09:01 paskal