## Keyboard.isDown is not working with G and H key.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
ddabrahim
Prole
Posts: 32
Joined: Mon May 17, 2021 8:05 pm
Contact:

### Keyboard.isDown is not working with G and H key.

Hi.

I'm using LOVE 11.3 on macOS 11.4 and I believe I have discovered a bug, but it could also be just my keyboard.
If I would like to do something when the G and the H key both is down and I also holding the Space key, so I have 3 key down Space, G and H then nothing is happening, the code is not firing. I experience this problem only with G and H. other keys are working.

Here is a project that reproduce the problem for me.
ghbugtest.love.zip
This is the code:

Code: Select all

local message

end

function love.update(dt)
if love.keyboard.isDown('g') and love.keyboard.isDown('h') then
message = 'G and H is down'
else
message = 'G and H is not down'
end
end

function love.draw()
love.graphics.print('Hold Space key and then press and hold G and H',0,100,0,2,2)
love.graphics.print(message,0,200,0,2,2)

end
Could someone please try and confirm if it a problem with my keyboard or my system or it is an actual BUG in LOVE?

Thanks.
Last edited by ddabrahim on Mon Jul 12, 2021 4:42 pm, edited 1 time in total.
grump
Party member
Posts: 818
Joined: Sat Jul 22, 2017 7:43 pm

### Re: [BUG] keyboard.isDown is not working with G and H key.

That's a hardware limitation, not a software bug. Common keyboards are not capable of recognizing arbitrary key combinations due to how their key matrix works. Different keyboards allow for different simultaneous key presses, there is no common pattern to it, and you should not rely on any specific behavior. Only explicit modifier keys such as Shift, Alt, etc. can be used like that.
darkfrei
Party member
Posts: 419
Joined: Sat Feb 08, 2020 11:09 pm

### Re: [BUG] keyboard.isDown is not working with G and H key.

This hardware bug was much often by PS/2 keyboards.
Falling in LÖVE
I Löve Lua and Love2D
pgimeno
Party member
Posts: 2829
Joined: Sun Oct 18, 2015 2:58 pm

### Re: [BUG] keyboard.isDown is not working with G and H key.

darkfrei
Party member
Posts: 419
Joined: Sat Feb 08, 2020 11:09 pm

### Re: [BUG] keyboard.isDown is not working with G and H key.

I can press QWER, ASDF, but not QAWS or QAED or QARF or WSED or EDRF

Code: Select all

function love.load()
keypressed = {}
end

function love.draw()
local y = 20
for key, scancode in pairs (keypressed) do
love.graphics.print ('key:	'..key..'	scancode:	'..scancode, 20, y)
y=y+20
end
end

function love.keypressed(key, scancode, isrepeat)
keypressed[key] = scancode
end

function love.keyreleased (key, scancode)
keypressed[key] = nil
end
Attachments
key-jamming-keyboard-01.love
Falling in LÖVE
I Löve Lua and Love2D
slime
Solid Snayke
Posts: 2954
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

### Re: [BUG] keyboard.isDown is not working with G and H key.

ddabrahim
Prole
Posts: 32
Joined: Mon May 17, 2021 8:05 pm
Contact:

### Re: [BUG] keyboard.isDown is not working with G and H key.

Thank you all!. I was suspecting it could be my keyboard but I had no clue it is a common problem with keyboards. The link to the 'ghost tester', did confirm Space+G+H does not send a signal on my keyboard for the last character. I wish I knew this earlier, spent hours debugging my code on the weekend Happy days!

### Who is online

Users browsing this forum: Google [Bot], GVovkiv and 51 guests