mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

pressing equals (=) key inserts a fraction instead of equal sign

Open Extner32 opened this issue 6 months ago • 3 comments

When pressing the equals key on my keyboard, after inserting a matrix, a fraction gets inserted instead of a equals sign (=). I'm not using a standard qwerty keyboard (I'm using azerty), just pressing the key just types a normal equals sign (and I don't need to press ctrl/alt/shift or something). Typing a slash(/) also inserts a fraction.

It's not because I broke something on my project because typing it on the interactive Mathfield on the CortexJS website also inserts a fraction.

Extner32 avatar Jun 30 '25 15:06 Extner32

I imagine providing information from this site may aid in fixing this issue: https://www.toptal.com/developers/keycode e.g.

Image

manstie avatar Jul 28 '25 05:07 manstie

Good idea! The problem seems to be that the code represents a slash and mathlive checks the event.code and not the event.key.

Image

Extner32 avatar Jul 28 '25 07:07 Extner32

Could you provide more details on what keys you pressed between the time the mathfield is created and the time you press the "=" key?

The problem is that the mathfield tries to guess your keyboard layout, and it uses the sequence of keys you press to do so. Pressing "=" on an AZERTY keyboard should switch it to the AZERTY layout, but somehow the sequence of keys you pressed before pressing "=" had the mathfield convinced you were not using an AZERTY layout...

FYI, you can work around this by explicitly setting the locale on the mathfield: mf.locale = "fr". This should set the AZERTY layout by default.

arnog avatar Jul 28 '25 16:07 arnog