I can connect a Sony DualSense (PS5) controller to Windows via USB or Bluetooth.
The HTML5 Gamepad API recognises the DualSense whether I connect over USB and Bluetooth work with https://gamepad-tester.com/
However with XInput the DualSense only works over USB. Over Bluetooth, nothing happens. https://thatsmytrunks.itch.io/xinput-controller-tester
Why is that? And can it be fixed? I tested an Xbox controller with XInput, and it works over either USB or Bluetooth.
DualSense isn't recognized through XInput because it's not an XInput compatible game controller. XInput is a legacy interface for Xbox 360 and Xbox One controllers and isn't compatible with HID gamepads.
You can run software like DS4Windows that will create a virtual XInput device that mirrors the inputs from a compatible controller. DS4Windows works with DualShock4, DualSense, Switch Pro Controller, and Switch Joy-Cons.
Applications that don't need compatibility with versions of Windows earlier than Windows 10 should use the Windows.Gaming.Input API which has built-in support for HID gamepads (including DualSense).
DualSense works in Chrome because Chrome uses the Windows HID API to read inputs from HID gamepads like DualSense.