mojira.dev
MC-210642

'previous' and 'next' media buttons are bind to 'Drop Selected item' and 'Social Interactions screen' respectively

The media buttons 'previous' and 'next' are assigned such that when pressed:

⏮ (previous): drops the selected item
and
⏭ (next): opens the Social Interactions screen/menu

Here i used the default minecraft keybindings where:
'q' key = drops item, and 'p' key =Social Interactions

Linked issues

Attachments

Comments 8

I was unable to reproduce this issue.

Please make sure that the issue is not caused by your keyboard. Does this also happen on a different keyboard?

Also, where are these keys located? Are they on the Function keys, or somewhere else?

This issue happens to me as well, it happens across razer keyboards that I've owned. I've looked into keybindings, and it only happens when any keys on the keyboard are bound to the media back and forward, or it will happen when the default unbound media keys are used. Oddly enough, if media back and forwards are assigned to a mouse, they do not have this effect in game, so only when there are media keys set on a keyboard do these problems happen.

I found that for some reason some apps interpret media-keys as 'g' 'j' 'q' and 'p', for some reason.
This is also apparent in MC if you go into the key-bind settings and assign to a media-key.
That would explain why MC also does that, but it is weird that it does, when other applications don't. Maybe it is just a default in some library or java, idk.

To answer violine1101's Q's:
I use my laptop keyboard, where some keys are accessed with (or if unlocked, without) a modifier key (Fn). But this has also been happening on other computers (which have had media-keys) that i have had.

Are you still able to reproduce this issue in 1.21? I am unable, as I seem to run into MC-127939 instead on my machine (Windows 11).

Yes the issue still persists, at least for me, mine runs on windows 10, but it would be weird if they decided to change how keyboards worked.
I've looked in to it a bit with waht i know from LWJGL, (if that is what used), as an interface between MC and the system when dealing with UI-events such as keystrokes, the individual keycodes are send and handled.

Problem might lie in the fact that normal keys and media-keys share the same codes, in a sense. For some (idk about everyone) when pressing a mediakey, both the mediakey-code and the unintented normal key-code are registered.

[media]

As seen here, in a keyboard event viewer (just one found online), when pressing a button normally, the code "KeyQ" and "KeyP" are fired with their respective event types. When pressing a mediakey, such as forward/next-track, the mediabutton code is "MediaTrackPrivous/-Next" on downstrokes, and "KeyQ/P" on upstrokes.
I would not know if that is fully how it works in the games code as per say, but it is an educated guess. and it is a bit weird that it would get counted as a full press.

The MediaPlayPause (ie. play/pause playing music) key has a "KeyG" code on its upstroke. If you then were to change to you drop key (or any key for that matter) to G and press the play/pause media-key, it would drop, as if you pressed G.
The same would happen for some keyboard where they have page up and down on the numpad, though function keys, where as an example, a PageDown would be associated with Numpad3 or something. Then Numpad3 is the key registered in game instead for PageDown, even with the key identifier, since it just uses the code keycode instead.

All in all it seems to be related what "special" keys, that might be in usual places or have funky associations with other keys on peoples keyboards, where there seems to be some weird standards. But the issue also lies in the interpretation of what 'data' is read as a key or keypress, Inconsistent keycodes vs. the actual key/other identifiers.

When you try to assign this key to a keybind in the controls settings, what does show up? For me it's "scancode.256" (see MC-127939).

Just 'p' or 'q' or whatever codes are applicable from the relation described: play-pause: "g", stop-track: "j", previous: "q", next: "p".
There are probabily loads more, form other special keys, that can have fun relations.

I also get "scancode.256" on volume-keys (up, down and mute), as in the other issue. Here both volume keys for me produces "scancode.256", so pressing any of them fires said key bound to "scancode.256".

Scancode.256 is one of many untranslated keys:
https://minecraft.wiki/w/Java_Edition_untranslated_keys

In the table, even the media-keys seem to be lumped under untranslated "scancode.256", which might be true for a keyboard with dedicated media-buttons, as opposed to remappked keys and keys activated with modifyers.

SebHL

(Unassigned)

Community Consensus

Input

1.16.4, 1.21

Retrieved