When a keybind is disabled while the key is being held down, the isPressed state remains true permanently because the (release) command handler returns early when data.disabled is true, skipping the data.isPressed = false reset.
To Reproduce
1. Create a keybind with lib.addKeybind
2. Press and hold the bound key → isPressed becomes true
3. While still holding the key, disable the keybind (keybind:disable(true))
4. Release the key → the - handler returns early due to data.disabled, isPressed stays true
5. Re-enable the keybind → isPressed is still true even though the key is not held
Expected behavior
isPressed should be set to false on key release regardless of the disabled state. The disabled check should only prevent the onReleased callback from firing, not the state reset.
Suggested fix
In the command handler, reset isPressed before the disabled check:
RegisterCommand('-' .. data.name, function()
data.isPressed = false
if data.disabled or IsPauseMenuActive() then return end
if data.onReleased then data:onReleased() end
end)
Additional context
This can cause unexpected behavior in any code that relies on keybind.isPressed or keybind:isControlPressed() to determine if a key is currently held, as it will report true indefinitely after this sequence occurs.
When a keybind is disabled while the key is being held down, the isPressed state remains true permanently because the (release) command handler returns early when data.disabled is true, skipping the data.isPressed = false reset.
To Reproduce
1. Create a keybind with lib.addKeybind
2. Press and hold the bound key → isPressed becomes true
3. While still holding the key, disable the keybind (keybind:disable(true))
4. Release the key → the - handler returns early due to data.disabled, isPressed stays true
5. Re-enable the keybind → isPressed is still true even though the key is not held
Expected behavior
isPressed should be set to false on key release regardless of the disabled state. The disabled check should only prevent the onReleased callback from firing, not the state reset.
Suggested fix
In the command handler, reset isPressed before the disabled check:
Additional context
This can cause unexpected behavior in any code that relies on keybind.isPressed or keybind:isControlPressed() to determine if a key is currently held, as it will report true indefinitely after this sequence occurs.