mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

With an Italian layout keyboard, some keys do not work as expected

Open chrostino opened this issue 1 year ago • 4 comments

Description

backslash / to trigger latex command broken on non US keyboard layout (ITA)

Steps to Reproduce

  1. using a non US keyboard layout (in my case an ITA‌ ISO layout)
  2. go to https://cortexjs.io/mathlive/demo/
  3. press the \ key to trigger latex commands list and write some symbols/something

Actual Behavior

the \ character is written and nothing happens, while if i press the key ù (which position overlaps with the position of the \ key on the US‌ ANSI layout) then latex commands are triggered as normal

Expected Behavior

ù key just writes the character and \ triggers latex commands

Environment

Is this a regression: did it use to work in a previous version?

MathLive version 0.98.6 Operating System Nobara 39

Browser Firefox

chrostino avatar Feb 09 '24 15:02 chrostino

Do you have a QWERTY or QZERTY layout?

FYI, the supported keyboard layouts are here: https://github.com/arnog/mathlive/tree/master/src/editor/keyboard-layouts

If someone has the mapping for an Italian Linux keyboard, feel free to submit a PR.

arnog avatar Feb 09 '24 22:02 arnog

Thanks I didn't know different keyboard layouts needed to be supported it's a QWERTY layout (ITA ISO), it's the most common italian layout, here's a picture image

chrostino avatar Feb 09 '24 23:02 chrostino

We've seen similar problems with Norwegian/Swedish keyboards, I've been meaning to create and submit layouts for those but have not found the time yet.

As a quick hack you can listen to the keyDown event and simply override the result.

if (evt.key === 'ù') {
  mf.insert('ù', { format: 'latex' });
  evt.preventDefault();
}

Leon-Lj avatar Mar 08 '24 11:03 Leon-Lj

I tried to make the italian one, mind I have like no experience so it is just a tentative but maybe it can be useful italian.txt

chrostino avatar Mar 21 '24 12:03 chrostino