[Bug][macOS] InputField reads Esc key as character

How to reproduce:

  • Open any Unity project with TextMeshPro 3.0.6 on macOS
  • Create new TMPro InputField in any scene [UI / InputField - TextMeshPro] and run Play-mode
  • Select the input field
  • Press Esc key

In my case it produces two actions: putting a square (□) character into the field and deselecting it.

Why did this happen?
macOS produces more than one event at pressing Esc key down. And TMP_InputField handle each event: first is about escaping from the field editing mode and the second is about reading a character with \u001B code (which is an Esc button’s code).

How I temporary solved it?
I’ve just added a breaking of a while-loop inside OnUpdateSelected() method in TMP_InputField.cs when
isFocused field equal false.
8221941--1073790--Screenshot 2022-06-21 at 15.57.18.png

1 Like

I’m having the same issue and would really like an option to automatically filter non-printable characters.

EDIT: Found a workaround (that works for now) via a discussion on the Quantum Console issue tracker:

1 Like

epik fix that still applies today