Ok, so noticing the keypress was the key step for solving this. Looks like it’s a common issue for HP laptops. I’m surprised that I didn’t find out about this earlier.
The answer provided here ended up working for me. I used the systemd method. Might work for you too.
In case the answer gets down or something, you basically have to create the following systemd unit file:
/etc/systemd/system/hp-keycodes.service
----------------------------------------
[Unit]
Description=HP setkeycodes fix
[Service]
Type=oneshot
Restart=no
RemainAfterExit=no
ExecStart=/usr/bin/setkeycodes e057 240 e058 240
[Install]
WantedBy=rescue.target
WantedBy=multi-user.target
WantedBy=graphical.target
and then enable it using
sudo systemctl daemon-reload
sudo systemctl enable --now hp-keycodes.service
and that should be it!