Hi there! I am trying to use the Web Serial API (https://web.dev/serial/) from a Godot web game. I am able to run the game without the API and use JavaScript.eval to call some API functions on Google Chrome, but this fails when trying to open a serial port:
var resp = JavaScript.eval("portPromise = navigator.serial.requestPort({ filters: [] });", true)
It fails because the method requires permission to access the Serial API and the code "must be handling a user gesture to show a permission request" (that's the js error that is triggered). In other words, Chrome requires the code which indirectly requests the permission (the call to requestPort) to be executed as a result of some user action, such as a click on an HTML button. This is apparently a security policy meant to make permission requests more understandable to the user: the permission request usually pops up a dialogue and if that happened after a user action such as a click, then the user may assume that the click is what caused the request.
How can I work around this in Godot please? Is there a way to trigger such a web user action through Godot? I am not sure how since AFAIK there are no HTML elements shown in Godot which may be used to trigger it. Thank you in advance for your answers!