It seems that on windows platform __oskeyboard eventually calls _user32.keybdevent.
However, it makes the pressed modifiers to release for some reason.
Note that modifiers and non-modifiers are different and this affect only modifiers.
You can replicate it through the following code:
import keyboard, time
while True:
time.sleep(2)
keyboard._os_keyboard.press(keyboard.key_to_scan_codes("right")[0])
Hold shift key and run the code, you will find that the text cursor moves but the text is not selected, which is a proof that the shift key is released for a sudden.
This can be patched by modifying send function.
It seems that on windows platform __oskeyboard eventually calls _user32.keybdevent. However, it makes the pressed modifiers to release for some reason. Note that modifiers and non-modifiers are different and this affect only modifiers. You can replicate it through the following code:
Hold shift key and run the code, you will find that the text cursor moves but the text is not selected, which is a proof that the shift key is released for a sudden. This can be patched by modifying send function.