mojira.dev
MC-147766

Shift key stays pressed until press any other key

The bug

While typing in a text box, if you press Shift once, it will start selecting text from that point until you press any other key (that is not Shift).

The expected behavior is that Shift should only select text if it's held down.

Example

Here is an example in video:

[media]

Code analysis

Based on decompiled sources of 22w42a, this can be fixed by overriding keyReleased() in EditBox.java like so:

@Override
public boolean keyReleased(int n, int n2, int n3) {
    this.shiftPressed = Screen.hasShiftDown();
    // possibly return super.keyReleased();
}

– @unknown in this comment

Linked issues

Attachments

Comments 7

Still in 1.14.1 Release

Still in 1.14.2 Pre-Release 1 and 1.14.2 Pre-Release 2

Confirmed in 1.15pre-6

It seems this confirmed bug doesn't have a priority assigned yet

Can confirm in 1.15.2

Confirmed in 20w51a

Based on decompiled sources of 22w42a, this can be fixed by overriding keyReleased() in EditBox.java like so:

@Override
public boolean keyReleased(int n, int n2, int n3) {
    this.shiftPressed = Screen.hasShiftDown();
    // possibly return super.keyReleased();
}

FACS01

Fantastime

Confirmed

Low

Input

shift, text-field

Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, ..., 22w11a, 1.19.3, 1.19.4 Pre-release 1, 1.20, 1.20.1

23w31a

Retrieved