mathlive
mathlive copied to clipboard
With an Italian layout keyboard, some keys do not work as expected
Description
backslash / to trigger latex command broken on non US keyboard layout (ITA)
Steps to Reproduce
- using a non US keyboard layout (in my case an ITA ISO layout)
- go to https://cortexjs.io/mathlive/demo/
- 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
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.
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
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();
}
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