The bug
Sometimes when opening chat it writes 't' (Different character if bound to another key). It doesn't appear to happen on Windows.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by
Comments

Actually this is unrelated to my hardware. It did not occur in 1.12.2, so it came with 1.13 or perhaps because of LWJGL 3.
This also happens to me too. I get duplicate key registers for the open chat key and open command key. Changing the open command key to the keypad 1 key results in "/1". This issue only ever happens when opening the chat buffer and not while its open. I've only had this issue with 1.13 snapshots and no other version of minecraft or any other program for that matter.
The bug seems to occur only on Linux operative systems. Had the same problem with another game too though!
This bug still persists in the latest snapshot
Can also confirm on Ubuntu 16.04 LTS on 1.13 release, however this bug does not appear on Windows on the same computer. If i downgrade to 1.12.2 then this issue does not occur.
Confirmed for 1.13 on Debian 9.5 with OpenRC
I can confirm this on 1.13.1 using Ubuntu 18.04.1
The same occurs when opening chat via the / key, which is annoying because when pressing /, Minecraft automatically inserts / at the beginning, so it inserts two / characters.
I use the gnome window manager
I can confirm this on 1.13.2 using Fedora 29
Can confirm this on both 1.13.2 and 1.14.
I am using Linux Mint 19.1 (MATE) with Oracle Sun Java 1.8.0_201.

I think this is related to your system (hardware or software). I had this issue before but fixed after some updates and don't know what exactly causes this issue.
I'm using Archlinux, GNOME/i3wm, OpenJDK 1.8.0_212.
Can confirm for Ubuntu 18.10.This issue is not present in older versions.
Binding the input key for chat/command to one that does not typically insert a text character is a work-around. (For example, setting "open chat/command" as Enter negates the duplicate t or /).
That's not a real workaround. The real cause of this problem is input lag, so typing would still be hard at low FPS.
Can confirm for Ubuntu 18.04.2 LTS x86_64 with Minecraft 1.14.4 using 5.1.0-050100-lowlatency kernel. Annoying as hell. Still, not fixed.
This is still happening in 1.15 pre-release 1.
did anyone find a way to fix this? it's driving me insane

Still, relevant for Ubuntu 19.10 with Minecraft 1.15.2 on OpenJDK 11. For me the problem appears only with Gnome desktop environment(tested with Cinnamon), mostly when FPS drop to <30.
Affects 20w08a.
This problem still persists, as well as it putting a t in chat quite often when I type. Bumping this in the hope it gets fixed soon. - Running 1.15.2 btw.
For anyone who wants to workaround this without rebinding keys, I wrote a mod for 1.15.2 trying to fix this. https://github.com/RecursiveG/Mc122477Fix
Happens with / for comments too (am using Ubuntu 20.04, has happened in all versions I've played)
Cannot reproduce on Arch Linux. Maybe input driver related? I'm using libinput.
grep -e "Using input driver " Xorg.0.log
Reproduced on Fedora 31 and Gnome version 3.34.6.
@unknown I'm on arch with libinput, but it happens for me too.
Reproduced on Arch Linux(linux: 5.7.2.arch1) with Gnome 3.36.3.1 on X11(xorg 1.20.8) and openjdk version 1.8.0_252
Reproduced in vanilla 1.16.1 running on Ubuntu 20.04, GNOME 3.36.2, Java 11.0.7 64-bit.
This also occurs when opening creative inventory on search tab, typing the character "e" (or whatever it's binded to). My temporary solution is just binding chat/command to page down and page up buttons so nothing is typed.

I have this same issue as well (I use Ubuntu 20.04 with KDE Plasma 5, 4GB RAM), but I also experience an issue that might have the same underlying cause.
The issue I am talking about is that my game input gets "lagged" in a way, and as soon as I open any text input (such as chat or world seed), the lagged input gets applied there.
Of course, that issue might be a separate issue entirely, but I felt as if it was worth mentioning here.
I cannot reproduce this on GalliumOS 3.1
This seems to only occur on GNOME DE (after versions 3.36.x?). Still, this bug does not occur on versions before 1.12.

Could this be https://github.com/glfw/glfw/issues/747 ?
In that case, this bug would be fixed by updating the version of glfw that Minecraft uses to 3.3.
By the way, if this is the issue, then to have the best chance of reproducing it, you want to use the X11 window manager, and make sure the game is running at a low framerate (client-side lag).
I'm not quite sure. I find that this issue sometimes occurs even when I am at a constant 60 fps with no lag spikes. Limiting my framerate to 10 fps doesn't make the issue more common.
I can reproduce on GNOME on Pop!_OS 20.04.
I cannot reproduce on KDE on Arch Linux.
Both are using xinput and X11.
Since I've first responded to this ticket I have rebuilt my PC and installed a different distro. I'm now using Pop!_OS 20.04 (GNOME), rather than Ubuntu 18.04, and this bug is still present. I've used KDE on this same machine and this bug does not happen on that desktop environment. At no point is FPS a factor in when this happens. My game has never been lagging when this happens; and it nearly always happens when opening the chat or entering a command.
This seems to be directly related to GNOME (perhaps on Ubuntu-like systems?), and happens regardless of system load or game lag.
Caused by https://github.com/glfw/glfw/issues/1794
Can confirm for 1.16.4 on Ubuntu 20.10
Not sure this is a bug. It sure happens though, I'm using macOS and I have my chat key as / and whenever I press it I have to delete the /
@Blanket Duck that is unrelated. When pressing `/`, this bug will add a second slash. When pressing `T`, which is the default key to open chat, 0 to 2 `t`s will be already in the input.
It does happen almost 100% of the time when the FPS is low, but limiting your FPS to 10 will not reproduce the bug. Limiting your framerate does not simulate overload on your PC.
I can reproduce the problem on Ubuntu 20.04.01 LTS x86_64 (DE: Gnome 3.36.8, WM: Mutter, Windowing system X11) with Minecraft 1.16.4.
The same problem has been reported as well here: https://gaming.stackexchange.com/questions/341086
The suggested solution (to change speed/delay of repeating keys in Settings > Universal Access) did not resolve this issue for me even with the slowest settings. I cannot reproduce this issue on older versions such as Minecraft 1.12.2.
I suspect this has to do with the updates keypresses are handled. Holding down `t` while in-game will open the chat and enter several `t`s inside. Holding E will toggle quickly the inventory, etc. Is it possible that repeating keys are handled by the game, since the OS settings have no effect on the issue?
@Eyyy This only happens on versions 1.13 and above. Lower versions dont reproduce this bug leading me to believe it is something to do with minecraft/is something that Mojang can fix.
You double pressing the chat open button?? that would register to computer as open chat for first "t" and type "t" in for second pressed "t"
Code analysis based on 1.16.5 with yarn mappings.
GLFW distinguishes between two kinds of inputs: key inputs and character inputs. Key inputs are for controls (e.g. WASD), while character inputs are for typing text (e.g., in chat).
Importantly, key inputs are not processed immediately; they are polled and then processed on the next game tick. Character inputs, on the other hand, are processed immediately when they are received.
When a button on the keyboard is pressed, like "t", a key event and then a char event are received. The key event is processed first, but remember that it doesn't do anything until the next game tick. Then, the char event is processed, but this doesn't do anything, because the chat hasn't opened yet. So, as long as there isn't a game tick between the key and char events, there won't be a phantom key press.
The game polls input events using glfwPollEvents(). This processes all incoming events at once, so the key and char events should both fire during one call to glfwPollEvents(), so a game tick cannot happen in between. However, on some Linux machines, the char event is actually received on the next poll (https://github.com/glfw/glfw/issues/1794). This means that there could be a game tick in between, meaning the chat will open and then receive the char event and type "t".
The reason this only happens sometimes is simply because the game polls events twice per frame. Specificially, com.mojang.blaze3d.systems.RenderSystem.flipFrame(long)
calls glfwPollEvents() twice. Therefore, two consecutive polls could sometimes have a game tick in between and sometimes not.
There is a Fabric mod available that fixes this https://github.com/RecursiveG/Mc122477Fix
This also affects the search item tab in the creative inventory screen, randomly writing an 'e' into the search bar when opening it.
Can confirm on 21w14a
I can confirm this still happens in 1.17
This bug is present in 1.17.1 as well.
I can confirm this bug for 21w39a.
Please, this should be fixed asap, it makes the chat unusable without this mod: https://github.com/RecursiveG/Mc122477Fix
I can't confirm this, but the bug may be specific to GNOME.
This doesn't happen on my PC (ArchLinux) which has KDE Plasma installed, but it does happen on my laptop which runs Ubuntu 21.04 with GNOME 3
Can confirm bug is still present in 1.18.1, running in Debian 11
For whatever reason, this issue doesn't seem to occur when playing vanilla 1.18.1 on MultiMC. However, it does occur when playing vanilla 1.18.1 on the official launcher.
Maybe it's because MultiMC uses different versions of some libraries? In that case, perhaps bumping the version of some library would fix this bug.

I am on Ubuntu 20.04 using Gnome Desktop Environment. On Lunar Client and normal Minecraft in 1.18, not only does opening chat send t, but pressing '/' sends another '/', making the content "//". Additionally, if I was moving before, it would spam whatever keys I was typing, and it would non stop type something like"wwwwwwwWWWWAAAAssssssssss" and it would not let me delete it or type anything else until it reaches the end of the input. It's driving me absolutely nuts!!!
I initially thought it was something wrong with my drivers, because I installed Ubuntu on my MacBook Air because it was too slow.
I can confirm this bug. I am running Ubuntu 20.04.2 (Gnome as well) and randomly about half of the time I press "t" to open chat, not only does it open the chat context but also types a "t" in it. There doesn't appear to be any other problems, in particular I am not getting duplicate letters when I type stuff. I am using the latest Minecraft version, namely 1.18.1 (unmodded, official launcher).
Edit: confirmed for Ubuntu 21.10 as well.
Edit²: confirmed for Ubuntu 22.04.
I can confirm what @unknown mentioned earlier: using MultiMC as the launcher doesn't seem to have this issue.

Can confirm pressing the slash key sometimes writes two slashes to the chat. Using Garuda Linux, an Arch-based distro.
it als ohppens with both t and / on ubuntu 20.04
Also on Fedora 36 Linux. And this (extra 't' and '//') has been troubling me for many years and many versions of Fedora. Is it really that hard to fix or do you just not care?
ZorinOS 16.2 (Ubuntu 20.04), I also have this issue and it's VERY annoying.... Please fix!
EndeavourOS on Linux 5.15 kernel. Still have this issue. I find it a little upsetting that official devs have resorted to recommending that we just use a different launcher :/ but i guess project managers will only assign bugs to devs that help the company earn money.
Reply from @unknown:
No developers have recommended to just use a different launcher. Users with [Mod] in their name are just regular players. We mentioned MultiMC in the comments to hopefully help the developers locate the cause of the issue. As the ticket is still open it's highly likely the developers will work on it – we just don't know when 😛.
My apologies! I misinterpreted that. And yeah, no I have nothing against devs but I do feel like the companies behind big products and games will not let their devs work on issues unless they feel they'll have monetary gain from it, so i do worry about that a bit.
For people who don't want to use a mod nor a particular launcher, they can build a patched libglfw.so
: build_patched_glfw.sh
Confirmed on Ubuntu 22.0.4 on MC Version 1.19.4
still annoying me constantly. @mojang/microsoft would you please fix this?

ohhh i thought i was just pressing the key twice lol. same applies with the command hotkey, "/"

I always thought everyone has this bug. This should be fixed.
Unrelated to Minecraft itself, it's either your computer, your mouse, or your touchpad. Everyone experiences this, some more than others, and there's nothing that Mojang can do to fix it. : /